Ios was granted access to your google account

Stay organized with collections Save and categorize content based on your preferences.

Some Google services, such as Drive, Gmail, and many others, provide public APIs that you can use to create apps that help users work with their data in these services. To access these services, apps must implement one of the OAuth 2.0 client flows to get consent from users and obtain access tokens, which grant access to the APIs.

You can use the Google Sign-In library, which implements the OAuth 2.0 flow for you, to get access tokens for the signed-in user.

Before you begin

You must complete the basic Google Sign-In integration.

1. Check which scopes have been granted

Before you make a call to a Google API, check which scopes have already been granted to your app, using the grantedScopes property of GIDGoogleUser:

Swift

let driveScope = "https://www.googleapis.com/auth/drive.readonly"
let grantedScopes = user.grantedScopes
if grantedScopes == nil || !grantedScopes!.contains(driveScope) {
  // Request additional Drive scope.
}

Objective-C

NSString *driveScope = @"https://www.googleapis.com/auth/drive.readonly";

// Check if the user has granted the Drive scope
if (![user.grantedScopes containsObject:driveScope]) {
  // request additional drive scope
}

Based on whether or not a certain scope has been granted by the user, you might need to make a request for an additional scope in order to support a particular interaction.

2. Request additional scopes

If you need to request additional scopes, call addScopes:presentingViewController:callback or addScopes:presentingWindow:callback to ask the user to grant your app additional access.

For example, to request read-only access to a user's Drive:

Swift

let additionalScopes = ["https://www.googleapis.com/auth/drive.readonly"]
GIDSignIn.sharedInstance.addScopes(additionalScopes, presenting: self) { user, error in
    guard error == nil else { return }
    guard let user = user else { return }

    // Check if the user granted access to the scopes you requested.
}

Objective-C

NSArray *additionalScopes = @[ @"https://www.googleapis.com/auth/drive.readonly" ];
[GIDSignIn.sharedInstance addScopes:additionalScopes
           presentingViewController:self
                           callback:^(GIDGoogleUser * _Nullable user,
                                      NSError * _Nullable error) {
    if (error) { return; }
    if (user == nil) { return; }

    // Check if the user granted access to the scopes you requested.
}];

3. Make an API call with fresh tokens

To ensure that your Google API calls always have unexpired access tokens attached, wrap the calls in a doWithFreshTokens: block:

Swift

user.authentication.do { authentication, error in
    guard error == nil else { return }
    guard let authentication = authentication else { return }

    // Get the access token to attach it to a REST or gRPC request.
    let accessToken = authentication.accessToken

    // Or, get an object that conforms to GTMFetcherAuthorizationProtocol for
    // use with GTMAppAuth and the Google APIs client library.
    let authorizer = authentication.fetcherAuthorizer()
}

Objective-C

[user.authentication doWithFreshTokens:^(GIDAuthentication * _Nullable authentication,
                                         NSError * _Nullable error) {
    if (error) { return; }
    if (authentication == nil) { return; }

    // Get the access token to attach it to a REST or gRPC request.
    NSString *accessToken = authentication.accessToken;

    // Or, get an object that conforms to GTMFetcherAuthorizationProtocol for
    // use with GTMAppAuth and the Google APIs client library.
    id<GTMFetcherAuthorizationProtocol> authorizer = [authentication fetcherAuthorizer];
}];

Use the access token to call the API, by either including the access token in the header of a REST or gRPC request (Authorization: Bearer ACCESS_TOKEN), or by using the fetcher authorizer with the Google APIs Client Library.

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 2022-10-18 UTC.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]

Should you grant iOS access to your Google Account?

You should only grant permission if you trust the app or service. The app or service may also automatically sign you in the next time you use it.

What does it mean when iOS was granted access to your Google Account?

Hi Kathy, that message indicates permission was given to allow your iphone or ipad to access your Google account and google products and services on your google account. iOS is simply the name Apple gives to their operating system. If you do not own an Apple device, you may want to take steps to secure your account.

What does granted access to your Google Account mean?

To help you safely share your data, Google lets you give third-party apps and services access to different parts of your Google Account. Third-party apps and services are created by companies or developers that aren't Google. For example, you may download an app that helps you schedule workouts with friends.