WHITECOLOR
WHITECOLOR

Reputation: 26122

Can not get refresh token for google drive (google API v2)

Trying to get refresh token for the my app to access google drive.

I implement all the steps in guide:

https://developers.google.com/drive/web/quickstart/quickstart-nodejs

Go URL

> https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file&respon
> se_type=code&client_id=...&redirect_uri=http%3A%2F%2Fl
> ocalhost&approval_prompt=force

Put got code in getTocket, always get response that contains only access_token, no refresh_token:

{ access_token: '...',
  token_type: 'Bearer',
  expires_in: 3600 }

What can be the problem?

I use alredy the client (clientId) to access youtube API (v2) and there I got refresh token. I tried to create another clientId but still could not get obtain refresh token.

I tried to use refresh token that I use for youtuve API with google drive, but it seems not to work. =(

Upvotes: 1

Views: 2266

Answers (1)

WHITECOLOR
WHITECOLOR

Reputation: 26122

I added "&access_type=offline" in URL request, it worked after.

Upvotes: 3

Related Questions