# GoogleSignIn Framework Reference

# GIDGoogleUser

    @interface GIDGoogleUser : NSObject <NSSecureCoding>

This class represents a signed-in user.
- `


  ### [userID](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(py)userID)


  ` The Google user ID.

  #### Declaration

  Swift

      var userID: String? { get }

  Objective-C

      @property (nonatomic, readonly, nullable) NSString *userID;

- `


  ### [profile](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(py)profile)


  ` The basic profile data for the user.

  #### Declaration

  Swift

      var profile: https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDProfileData.html? { get }

  Objective-C

      @property (nonatomic, readonly, nullable) https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDProfileData.html *profile;

- `


  ### [grantedScopes](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(py)grantedScopes)


  ` The OAuth2 scopes granted to the app in an array of `NSString`.

  #### Declaration

  Swift

      var grantedScopes: [String]? { get }

  Objective-C

      @property (nonatomic, readonly, nullable) NSArray<NSString *> *grantedScopes;

- `


  ### [configuration](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(py)configuration)


  ` The configuration that was used to sign in this user.

  #### Declaration

  Swift

      var configuration: https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDConfiguration.html { get }

  Objective-C

      @property (nonatomic, readonly) https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDConfiguration.html *_Nonnull configuration;

- `


  ### [accessToken](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(py)accessToken)


  ` The OAuth2 access token to access Google services.

  #### Declaration

  Swift

      var accessToken: https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDToken.html { get }

  Objective-C

      @property (nonatomic, readonly) https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDToken.html *_Nonnull accessToken;

- `


  ### [refreshToken](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(py)refreshToken)


  ` The OAuth2 refresh token to exchange for new access tokens.

  #### Declaration

  Swift

      var refreshToken: https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDToken.html { get }

  Objective-C

      @property (nonatomic, readonly) https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDToken.html *_Nonnull refreshToken;

- `


  ### [idToken](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(py)idToken)


  ` The 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: https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDToken.html? { get }

  Objective-C

      @property (nonatomic, readonly, nullable) https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDToken.html *idToken;

- `


  ### [fetcherAuthorizer](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(py)fetcherAuthorizer)


  ` The authorizer for use with `GTLRService`, `GTMSessionFetcher`, or `GTMHTTPFetcher`.

  #### Declaration

  Swift

      var fetcherAuthorizer: Any { get }

  Objective-C

      @property (nonatomic, readonly) id _Nonnull fetcherAuthorizer;

- `


  ### [-refreshTokensIfNeededWithCompletion:](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(im)refreshTokensIfNeededWithCompletion:)


  ` Refresh the user's access and ID tokens if they have expired or are about to expire.

  #### Declaration

  Swift

      func refreshTokensIfNeeded() async throws -> GIDGoogleUser

  Objective-C

      - (void)refreshTokensIfNeededWithCompletion:
          (nonnull void (^)(GIDGoogleUser *_Nullable, NSError *_Nullable))completion;

  #### Parameters

  |---|---|
  | ` completion ` | A completion block that takes a `GIDGoogleUser` or an error if the attempt to refresh tokens was unsuccessful. The block will be called asynchronously on the main queue. |

- `


  ### [-addScopes:presentingViewController:completion:](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(im)addScopes:presentingViewController:completion:)


  ` Starts an interactive consent flow on iOS to add new scopes to the user's `https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser.html#/c:objc(cs)GIDGoogleUser(py)grantedScopes`.

  The completion will be called at the end of this process. If successful, a `https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignInResult.html`
  instance will be returned reflecting the new scopes and saved sign-in state will be updated.

  #### Declaration

  Swift

      func addScopes(_ scopes: [String], presenting presentingViewController: UIViewController) async throws -> https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignInResult.html

  Objective-C

      - (void)addScopes:(nonnull NSArray<NSString *> *)scopes
          presentingViewController:
              (nonnull UIViewController *)presentingViewController
                        completion:(nullable void (^)(https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignInResult.html *_Nullable,
                                                      NSError *_Nullable))completion;

  #### Parameters

  |---|---|
  | ` scopes ` | The scopes to ask the user to consent to. |
  | ` presentingViewController ` | The view controller used to present `SFSafariViewContoller` on iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on iOS 13+. |
  | ` completion ` | The optional block that is called on completion. This block will be called asynchronously on the main queue. |

- `


  ### [-addScopes:presentingWindow:completion:](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser#/c:objc(cs)GIDGoogleUser(im)addScopes:presentingWindow:completion:)


  ` Starts an interactive consent flow on macOS to add new scopes to the user's `https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDGoogleUser.html#/c:objc(cs)GIDGoogleUser(py)grantedScopes`.

  The completion will be called at the end of this process. If successful, a `https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignInResult.html`
  instance will be returned reflecting the new scopes and saved sign-in state will be updated.

  #### Declaration

  Swift

      func addScopes(_ scopes: [String], presentingWindow: Any!) async throws -> https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignInResult.html

  Objective-C

      - (void)addScopes:(nonnull NSArray<NSString *> *)scopes
          presentingWindow:(id)presentingWindow
                completion:(nullable void (^)(https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignInResult.html *_Nullable,
                                              NSError *_Nullable))completion;

  #### Parameters

  |---|---|
  | ` scopes ` | An array of scopes to ask the user to consent to. |
  | ` presentingWindow ` | The window used to supply `presentationContextProvider` for `ASWebAuthenticationSession`. |
  | ` completion ` | The optional block that is called on completion. This block will be called asynchronously on the main queue. |