简体   繁体   中英

OAuth 2.0: Resending the Refresh Token

I'm using OAuth 2.0 via PHP to offer users access to their Google Analytics data as part of a CMS. I've programmatically selected "offline" mode so I receive an access token and a refresh token once authenticated. When the access token expires, I use the refresh token to obtain a new access token. All is well and things are working great.

The problem is that some of my app's users have two or more [legitimate] accounts with my app:

account_1@myapp.com
account_2@myapp.com

And both need to have access to data from the same Google account:

account@google.com

When they first authorize account_1@myapp.com to access account@google.com's data, an access token AND a refresh token get sent back as expected. But then when they try to authorize account_2@myapp.com, only an access token gets sent back (presumably because the refresh token has already been issued by Google).

Is there any way to request the refresh token again without resetting it?

Have you explored adding approval_prompt=force to the authorization request? See this discussion on the Google OAuth 2 group.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM