Stay organized with collections Save and categorize content based on your preferences.
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.
DeclarationObjective-C
@property (nonatomic, readonly, nullable) GIDProfileData *profile;
The OAuth2 scopes granted to the app in an array of NSString
.
Swift
var grantedScopes: [String]? { get }
Objective-C
@property (nonatomic, readonly, nullable) NSArray<NSString *> *grantedScopes;
The configuration that was used to sign in this user.
DeclarationObjective-C
@property (nonatomic, readonly) GIDConfiguration *_Nonnull configuration;
The OAuth2 access token to access Google services.
DeclarationObjective-C
@property (nonatomic, readonly) GIDToken *_Nonnull accessToken;
The OAuth2 refresh token to exchange for new access tokens.
DeclarationSwift
var refreshToken: GIDToken { get }
Objective-C
@property (nonatomic, readonly) GIDToken *_Nonnull refreshToken;
Objective-C
@property (nonatomic, readonly, nullable) GIDToken *idToken;
The authorizer for use with GTLRService
, GTMSessionFetcher
, or GTMHTTPFetcher
.
Swift
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 -> 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.
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 GIDSignInResult
instance will be returned reflecting the new scopes and saved sign-in state will be updated.
Swift
func addScopes(_ scopes: [String], presenting presentingViewController: UIViewController) async throws -> GIDSignInResult
Objective-C
- (void)addScopes:(nonnull NSArray<NSString *> *)scopes
presentingViewController:
(nonnull UIViewController *)presentingViewController
completion:(nullable void (^)(GIDSignInResult *_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.
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 GIDSignInResult
instance will be returned reflecting the new scopes and saved sign-in state will be updated.
Swift
func addScopes(_ scopes: [String], presentingWindow: Any!) async throws -> GIDSignInResult
Objective-C
- (void)addScopes:(nonnull NSArray<NSString *> *)scopes
presentingWindow:(id)presentingWindow
completion:(nullable void (^)(GIDSignInResult *_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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-19 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-19 UTC."],[[["The `GIDGoogleUser` class represents a signed-in Google user and provides access to their profile information, granted scopes, and tokens."],["It offers methods to refresh tokens, add scopes, and authorize requests to Google services."],["Properties like `userID`, `profile`, `accessToken`, and `refreshToken` provide essential user data and authentication credentials."],["Developers can use the `fetcherAuthorizer` property with `GTLRService`, `GTMSessionFetcher`, or `GTMHTTPFetcher` to authorize requests."],["`refreshTokensIfNeededWithCompletion` and `addScopes` methods allow for refreshing tokens and adding scopes interactively."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4