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 (readonly, nonatomic) NSString *clientID;
  • The OAuth2 access token to access Google services.

    Declaration

    Swift

    var accessToken: String! { get }

    Objective-C

    @property (readonly, nonatomic) NSString *accessToken;
  • The estimated expiration date of the access token.

    Declaration

    Swift

    var accessTokenExpirationDate: Date! { get }

    Objective-C

    @property (readonly, nonatomic) NSDate *accessTokenExpirationDate;
  • The OAuth2 refresh token to exchange for new access tokens.

    Declaration

    Swift

    var refreshToken: String! { get }

    Objective-C

    @property (readonly, nonatomic) NSString *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 (readonly, nonatomic) NSString *idToken;
  • The estimated expiration date of the ID token.

    Declaration

    Swift

    var idTokenExpirationDate: Date! { get }

    Objective-C

    @property (readonly, nonatomic) NSDate *idTokenExpirationDate;
  • Gets a new authorizer for GTLService, GTMSessionFetcher, or GTMHTTPFetcher.

    Declaration

    Objective-C

    - (id<GTMFetcherAuthorizationProtocol>)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 getTokensWithHandler(_ handler: GIDAuthenticationHandler!)

    Objective-C

    - (void)getTokensWithHandler:(GIDAuthenticationHandler)handler;

    Parameters

    handler

    A callback block that takes a GIDAuthentication, or an error if attempt to refresh was unsuccessful.

  • Refreshes the access token and the ID token using the refresh token.

    Declaration

    Swift

    func refreshTokens(handler: GIDAuthenticationHandler!)

    Objective-C

    - (void)refreshTokensWithHandler:(GIDAuthenticationHandler)handler;

    Parameters

    handler

    A callback block that takes a GIDAuthentication, or an error if attempt to refresh was unsuccessful.