AI-generated Key Takeaways
- 
          GIDGoogleUser represents a signed-in user. 
- 
          It provides properties like userID, profile, grantedScopes, configuration, accessToken, refreshToken, idToken, and fetcherAuthorizer to access user information and tokens. 
- 
          The class includes methods to refresh tokens and add new scopes via an interactive consent flow. 
GIDGoogleUser
@interface GIDGoogleUser : NSObject <NSSecureCoding>This class represents a signed-in user.
- 
                  
                  The Google user ID. DeclarationSwift var userID: String? { get }Objective-C @property (nonatomic, readonly, nullable) NSString *userID;
- 
                  
                  The basic profile data for the user. DeclarationSwift var profile: GIDProfileData? { get }Objective-C @property (nonatomic, readonly, nullable) GIDProfileData *profile;
- 
                  
                  The OAuth2 scopes granted to the app in an array of NSString.DeclarationSwift var grantedScopes: [String]? { get }Objective-C @property (nonatomic, readonly, nullable) NSArray<NSString *> *grantedScopes;
- 
                  
                  The configuration that was used to sign in this user. DeclarationSwift var configuration: GIDConfiguration { get }Objective-C @property (nonatomic, readonly) GIDConfiguration *_Nonnull configuration;
- 
                  
                  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. 
- 
                  
                  The authorizer for use with GTLRService,GTMSessionFetcher, orGTMHTTPFetcher.DeclarationSwift var fetcherAuthorizer: Any { get }Objective-C @property (nonatomic, readonly) id _Nonnull fetcherAuthorizer;
- 
                  
                  Refresh the user’s access and ID tokens if they have expired or are about to expire. DeclarationSwift func refreshTokensIfNeeded() async throws -> GIDGoogleUserObjective-C - (void)refreshTokensIfNeededWithCompletion: (nonnull void (^)(GIDGoogleUser *_Nullable, NSError *_Nullable))completion;ParameterscompletionA completion block that takes a GIDGoogleUseror an error if the attempt to refresh tokens was unsuccessful. The block will be called asynchronously on the main queue.
- 
                  
                  Starts an interactive consent flow on iOS to add new scopes to the user’s grantedScopes.The completion will be called at the end of this process. If successful, a GIDSignInResultinstance will be returned reflecting the new scopes and saved sign-in state will be updated.DeclarationSwift func addScopes(_ scopes: [String], presenting presentingViewController: UIViewController) async throws -> GIDSignInResultObjective-C - (void)addScopes:(nonnull NSArray<NSString *> *)scopes presentingViewController: (nonnull UIViewController *)presentingViewController completion:(nullable void (^)(GIDSignInResult *_Nullable, NSError *_Nullable))completion;ParametersscopesThe scopes to ask the user to consent to. presentingViewControllerThe view controller used to present SFSafariViewContolleron iOS 9 and 10 and to supplypresentationContextProviderforASWebAuthenticationSessionon iOS 13+.completionThe optional block that is called on completion. This block will be called asynchronously on the main queue. 
- 
                  
                  Starts an interactive consent flow on macOS to add new scopes to the user’s grantedScopes.The completion will be called at the end of this process. If successful, a GIDSignInResultinstance will be returned reflecting the new scopes and saved sign-in state will be updated.DeclarationSwift func addScopes(_ scopes: [String], presentingWindow: Any!) async throws -> GIDSignInResultObjective-C - (void)addScopes:(nonnull NSArray<NSString *> *)scopes presentingWindow:(id)presentingWindow completion:(nullable void (^)(GIDSignInResult *_Nullable, NSError *_Nullable))completion;ParametersscopesAn array of scopes to ask the user to consent to. presentingWindowThe window used to supply presentationContextProviderforASWebAuthenticationSession.completionThe optional block that is called on completion. This block will be called asynchronously on the main queue.