jayarjo
jayarjo

Reputation: 16716

The App keeps asking for permission to "Have offline access", why?

After having authorized the app with oAuth2 and acquiring permissions for requested scopes, I still get a screen asking if I grant the app permission to Have offline access, each time I try to login with Google oAuth2. Isn't it something that shouldn't appear again, once I grant it permission to have it?

enter image description here

Upvotes: 34

Views: 21746

Answers (5)

Ayman Mahgoub
Ayman Mahgoub

Reputation: 4210

Most probably this is very normal according to the incremental auth mechanism and its design, The idea is if a user has already granted the permissions to an app, there is no need to show the same permissions and ask the user to approve.

http://googleplusplatform.blogspot.com/2013/12/google-sign-in-improvements11.html

Upvotes: -1

ngocld
ngocld

Reputation: 151

This is not an error. This is the normal scenario of google oauth2.

First Process consent as follows:

  1. User consents to the application getting information about the user.
  2. When user clicks Accept button, browser will save consent info into cookie and google account will save permission (please view https://security.google.com/settings/security/permissions)

From Second Process:

Browser checks cookie consent permisson of google account.

  • If cookie exists in browser and has permission for this application (https://security.google.com/settings/security/permissions): consent screen will be ignored
  • If cookie exists in browser but does not have permission for this application: consent screen will be displayed
  • If cookie does not exist in browser: application will display 'Have offline access'.

Upvotes: 6

Deepak Mittal
Deepak Mittal

Reputation: 199

This prompt could come because of two parameters,

  • access_type (if it is 'offline')
  • approval_prompt (if it is 'force')

make sure you have set access_type to 'online' and apporoval_prompt to 'auto'

 $client->setAccessType('online');
 $client->setApprovalPrompt('auto') ;

Upvotes: 13

user2897701
user2897701

Reputation:

Do you use the approval_prompt parameter? Try not to ask for offline access again if you already have an refresh token. It should stay valid even if the user logs in again, without requesting offline access.

A reference about this can be found here.

Upvotes: 10

pinoyyid
pinoyyid

Reputation: 22286

My guess is that your app has approval_prompt=force to force the OAuth each time. Since the user has already authorised whatever scopes you requested, there is no need to repeat them. However the screen has to say something, so in the absence of any better ideas, Google requests 'offline access".

Just make sure that you are not forcing auth and you should be fine.

Upvotes: 7

Related Questions