Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FirebaseAppDistribution/Sources/FIRFADApiService.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ FOUNDATION_EXPORT NSString *const kFIRFADApiErrorDomain;
// Fetch releases from the AppDistribution Tester API
+ (void)fetchReleasesWithCompletion:(FIRFADFetchReleasesCompletion)completion;

// Generate a Installation Auth Token and fetch the installation id
// Generate an installation auth token and fetch the installation id
+ (void)generateAuthTokenWithCompletion:(FIRFADGenerateAuthTokenCompletion)completion;

@end
Expand Down
2 changes: 1 addition & 1 deletion FirebaseAppDistribution/Sources/FIRFADApiService.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ + (void)generateAuthTokenWithCompletion:(FIRFADGenerateAuthTokenCompletion)compl
FIRInstallationsAuthTokenResult *_Nullable authTokenResult,
NSError *_Nullable error) {
if ([self handleError:&error
description:@"Failed to generate Firebase Installation Auth Token."
description:@"Failed to generate Firebase installation auth token."
code:FIRFADApiTokenGenerationFailure]) {
FIRFADErrorLog(@"Error getting fresh auth tokens. Error: %@", [error localizedDescription]);

Expand Down
1 change: 1 addition & 0 deletions FirebaseInstallations/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [changed] Removed the `FIR` prefix from `FIRInstallationIDDidChange` and renamed
`kFIRInstallationIDDidChangeNotificationAppNameKey` to `InstallationIDDidChangeAppNameKey`
in Swift.
- [changed] API docs updated to use term "installation auth token" consistently. (#6014)

# v1.7.1 -- M81
- [changed] Additional `FIRInstallationsItem` validation to catch potential storage issues. (#6570)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ - (NSString *)IIDWithPublicKeyData:(NSData *)publicKeyData {
return [self base64URLEncodedStringWithData:data];
}

/** FirebaseInstallations SDK uses the SHA1 hash for backwards compatibility with the legacy
* FirebaseInstanceID SDK. The SHA1 hash is used to access Instance IDs stored on the device and not
* for any security-relevant process. This is a one-time step that allows migration of old client
* identifiers. Cryptographic security is not needed here, so potential hash collisions are not a
* problem.
*/
- (NSData *)sha1WithData:(NSData *)data {
unsigned char output[CC_SHA1_DIGEST_LENGTH];
unsigned int length = (unsigned int)[data length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
* Parses and validates the Register Installation API response and returns a corresponding
* `FIRInstallationsItem` instance on success.
* @param JSONData The data with JSON encoded API response.
* @param date The Auth Token expiration date will be calculated as `date` +
* @param date The installation auth token expiration date will be calculated as `date` +
* `response.authToken.expiresIn`. For most of the cases `[NSDate date]` should be passed there. A
* different value may be passed e.g. for unit tests.
* @param outError A pointer to assign a specific `NSError` instance in case of failure. No error is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ typedef NS_ENUM(NSInteger, FIRInstallationsAuthTokenStatus) {
@interface FIRInstallationsStoredAuthToken : NSObject <NSSecureCoding, NSCopying>
@property FIRInstallationsAuthTokenStatus status;

/// The token that can be used to authorize requests to Firebase backend.
/// The installation auth token string that can be used to authorize requests to Firebase backend.
@property(nullable, copy) NSString *token;
/// The date when the auth token expires.
/// The installation auth token expiration date.
@property(nullable, copy) NSDate *expirationDate;

/// The version of local storage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN

/// A stable identifier that uniquely identifies the app instance.
@property(nonatomic, copy, nullable) NSString *firebaseInstallationID;
/// The `refreshToken` is used to authorize the auth token requests.
/// The `refreshToken` is used to authorize the installation auth token requests.
@property(nonatomic, copy, nullable) NSString *refreshToken;

@property(nonatomic, nullable) FIRInstallationsStoredAuthToken *authToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,24 @@ NS_SWIFT_NAME(Installations)
- (void)installationIDWithCompletion:(FIRInstallationsIDHandler)completion;

/**
* Retrieves (locally if it exists or from the server) a valid authorization token. An existing
* token may be invalidated or expired, so it is recommended to fetch the auth token before each
* server request. The method does the same as `Installations.authTokenForcingRefresh(:,
* Retrieves (locally if it exists or from the server) a valid installation auth token. An existing
* token may be invalidated or expired, so it is recommended to fetch the installation auth token
* before each server request. The method does the same as `Installations.authTokenForcingRefresh(:,
* completion:)` with forcing refresh `NO`.
* @param completion A completion handler which is invoked when the operation completes. See
* `InstallationsTokenHandler` for additional details.
*/
- (void)authTokenWithCompletion:(FIRInstallationsTokenHandler)completion;

/**
* Retrieves (locally or from the server depending on `forceRefresh` value) a valid authorization
* token. An existing token may be invalidated or expire, so it is recommended to fetch the auth
* token before each server request. This method should be used with `forceRefresh == YES` when e.g.
* a request with the previously fetched auth token failed with "Not Authorized" error.
* @param forceRefresh If `YES` then the locally cached auth token will be ignored and a new one
* will be requested from the server. If `NO`, then the locally cached auth token will be returned
* if exists and has not expired yet.
* Retrieves (locally or from the server depending on `forceRefresh` value) a valid installation
* auth token. An existing token may be invalidated or expire, so it is recommended to fetch the
* installation auth token before each server request. This method should be used with `forceRefresh
* == YES` when e.g. a request with the previously fetched installation auth token failed with "Not
* Authorized" error.
* @param forceRefresh If `YES` then the locally cached installation auth token will be ignored and
* a new one will be requested from the server. If `NO`, then the locally cached installation auth
* token will be returned if exists and has not expired yet.
* @param completion A completion handler which is invoked when the operation completes. See
* `InstallationsTokenHandler` for additional details.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

NS_ASSUME_NONNULL_BEGIN

/** The class represents a result of the auth token request. */
/** The class represents a result of the installation auth token request. */
NS_SWIFT_NAME(InstallationsAuthTokenResult)
@interface FIRInstallationsAuthTokenResult : NSObject

/** The authorization token string. */
/** The installation auth token string. */
@property(nonatomic, readonly) NSString *authToken;

/** The auth token expiration date. */
/** The installation auth token expiration date. */
@property(nonatomic, readonly) NSDate *expirationDate;

@end
Expand Down