Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateAuthUrl() generated url always asks for offline access #74

Closed
Cir0X opened this issue Feb 23, 2016 · 3 comments
Closed

generateAuthUrl() generated url always asks for offline access #74

Cir0X opened this issue Feb 23, 2016 · 3 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@Cir0X
Copy link

Cir0X commented Feb 23, 2016

the generateAuthUrl() method generatates thee different urls for me, which differs from the access_type parameter

with access_type = 'online':

https://accounts.google.com/o/oauth2/auth?access_type=online&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&response_type=code...

with access_type = 'offline':

https://accounts.google.com/o/oauth2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&response_type=code...

and without access_type (according to this example it should defaults to online):

https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&response_type=code...

Regardless of the url, there is always a prompt asking for offline access.

The version of the library I've used: 0.9.6

The code I've used to generate the url:

var url = oauth2Client.generateAuthUrl({
    access_type: 'online',
    scope: 'https://www.googleapis.com/auth/userinfo.profile'
});
@murgatroid99
Copy link
Contributor

According to the OpenID documentation, access_type is optional and if it is absent, the server behaves as though it was "offline", which is exactly the behavior that the example indicates.

What is this "prompt asking for offline access"? I don't see anything like that in this library.

@Cir0X
Copy link
Author

Cir0X commented Sep 27, 2016

This prompt from google:

It seems that this only occurs, when my redirect_uri is localhost.

@JustinBeckwith
Copy link
Contributor

Greetings @Cir0X! I'm having a little trouble reproducing this one. I am using the example here:
https://github.com/google/google-auth-library-nodejs/blob/next/examples/oauth2.js

I changed the sample to use this for url generation, and even tried to force the consent dialog:

// Generate the url that will be used for the consent dialog.
const authorizeUrl = oAuth2Client.generateAuthUrl({
  access_type: 'offline',
  scope: [
    'https://www.googleapis.com/auth/userinfo.profile',
    'https://www.googleapis.com/auth/devstorage.read_write',
    'https://www.googleapis.com/auth/plus.me',
    'https://www.googleapis.com/auth/compute'
  ],
  prompt: 'consent select_account'
});

This generates a consent dialog, but nowhere does it ask me if I should allow offline access:

image

Note, my redirect_uri is set to localhost:3000. I am also using the alpha npm release of our 1.0 library, which you can try out at npm install google-auth-library@1.0.0-alpha.1.

Given that this issue is nearly a year old, I'm going to go ahead and close it out. if you can include detailed instructions on how to reproduce it - I'd be happy to take a look :)

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
@JustinBeckwith JustinBeckwith self-assigned this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants