1
votes

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. =(

1
looking for this issue also brought me here but another post added the final piece of the puzzle stackoverflow.com/questions/28564758/… Send the generateAuthUrl call approval_prompt: 'force'rob

1 Answers

3
votes

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