Do not receive update token in youtube OAuth

I am doing oauth server side following this guide.

I successfully completed oauth, but I do not get refresh_tokenin the Exchange authorization code to update and access tokens:

Inquiry:

POST /o/oauth2/token HTTP/1.1
HOST: accounts.google.com
content-type: application/x-www-form-urlencoded
content-length: 260

code=4/KEOuzih9jwfnHj7Rl1DeqHhcJF0goKPwtwR5IQ09ieg&client_id=****.apps.googleusercontent.com&client_secret=****&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2FsSignIn.html&grant_type=authorization_code

Answer:

{
  "access_token" : "****",
  "expires_in" : 3580,
  "token_type" : "Bearer"
}

Did I miss something?

+4
source share
1 answer

Two things must be done:

  • To get the update token, you must pass access_type=offlineoauth as a request parameter to the start request. This will make sure that you get the update token when you run oauth for the first time for the account.
  • oauth , prompt=consent oauth start.

: https://developers.google.com/identity/protocols/OAuth2WebServer#offline

+3

Source: https://habr.com/ru/post/1661978/


All Articles