GIDAuthentication
@interface GIDAuthentication : NSObject <NSSecureCoding>
This class represents the OAuth 2.0 entities needed for sign-in.
-
The client ID associated with the authentication.
Declaration
Swift
var clientID: String { get }
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull clientID;
-
The OAuth2 access token to access Google services.
Declaration
Swift
var accessToken: String { get }
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull accessToken;
-
The estimated expiration date of the access token.
Declaration
Swift
var accessTokenExpirationDate: Date { get }
Objective-C
@property (nonatomic, readonly) NSDate *_Nonnull accessTokenExpirationDate;
-
The OAuth2 refresh token to exchange for new access tokens.
Declaration
Swift
var refreshToken: String { get }
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull refreshToken;
-
An OpenID Connect ID token that identifies the user. Send this token to your server to authenticate the user there. For more information on this topic, see https://developers.google.com/identity/sign-in/ios/backend-auth
Declaration
Swift
var idToken: String? { get }
Objective-C
@property (nonatomic, readonly, nullable) NSString *idToken;
-
The estimated expiration date of the ID token.
Declaration
Swift
var idTokenExpirationDate: Date? { get }
Objective-C
@property (nonatomic, readonly, nullable) NSDate *idTokenExpirationDate;
-
Gets a new authorizer for
GTLService
,GTMSessionFetcher
, orGTMHTTPFetcher
.Declaration
Swift
func fetcherAuthorizer() -> Any
Objective-C
- (nonnull id)fetcherAuthorizer;
Return Value
A new authorizer
-
Get a valid access token and a valid ID token, refreshing them first if they have expired or are about to expire.
Declaration
Swift
func `do`(freshTokens action: @escaping GIDAuthenticationAction)
Objective-C
- (void)doWithFreshTokens:(nonnull GIDAuthenticationAction)action;
Parameters
action
A callback block that takes a
GIDAuthentication
or an error if the attempt to refresh tokens was unsuccessful. The block will be called asynchronously on the main queue.