简体   繁体   中英

How can I get access_token from refresh token at android oAuth

I am developing small android app which fetch the google contacts with google contacts api.

Now I am getting access_token and refresh_token from oAuth. But at next launch user does not need google login again. so I am going to get the access_token from refresh token.

Can you let me know the best way to get access_token from refresh_token?

Many thanks.

I think access_type=offline suits for your usecase.

If your application needs offline access to a Google API, then the request for an authorization code should include the access_type parameter, where the value of that parameter is offline.

This will return the refresh token the first time the user authorises the app. Subsequent calls do not force you to re-approve the app (approval_prompt=force).

You can refer to this page for more details: https://developers.google.com/accounts/docs/OAuth2WebServer#offline

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