How to generate access token using refresh token through google drive API?

前端 未结 8 1373
一个人的身影
一个人的身影 2020-12-04 14:33

I have completed steps of authorization and obtained access token and refresh token.

What should I do next to generate access token using refresh token that I have s

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 14:51

    If you are using web api then you should make a http POST call to URL : https://www.googleapis.com/oauth2/v4/token with following request body

    client_id: 
    client_secret: 
    refresh_token: 
    grant_type: refresh_token
    

    refresh token never expires so you can use it any number of times. The response will be a JSON like this:

    {
      "access_token": "your refreshed access token",
      "expires_in": 3599,
      "scope": "Set of scope which you have given",
      "token_type": "Bearer"
    }
    

提交回复
热议问题