0

I am making a server side web app that integrates with Google Drive's "Open With" button. I've been able to get a refresh token with the InstalledAppFlow in the python client library (go to my install endpoint redirect user to consent screen and google uses the redirect_uri to send the code to my server) and access the data I want.

What I don't understand now is how do I get a refresh token after a user installs and consents to the permissions requested by my app in the GSuite marketplace? Does Google post the information to one of the redirect URIs of your OAuth2.0 client Ids? Do I have to ask the user for consent again and get the refresh token as before when he uses "Open With" from Google Drive?

Its not clear to me how the oauth flow works with apps installed through the GSuite Marketplace. Thanks for any help!

  • Refresh tokens are given to you automatically, you don't need to ask for permission from your users again unless the scopes of the application change. Can you post your code? You'll need t orequest offline access. See [here](https://stackoverflow.com/questions/60778266/) – Rafa Guillermo Jul 20 '20 at 14:42
  • Check out the [documentation on refreshing access tokens](https://developers.google.com/identity/protocols/oauth2/web-server#offline) – Rafa Guillermo Jul 20 '20 at 15:15
  • @RafaGuillermo I am able to get a refresh token the way its done in what you've shared. My question is where I can get a refresh token from when a user goes to my app in the Google Apps Marketplace, clicks install and clicks "Allow" in Google's OAuth consent screen. After that I can see [here](https://myaccount.google.com/permissions) that my app has been been granted access to the account. But how do I get a refresh token after this to then store it? Is it clear what I mean? – HumbleCatcher Jul 20 '20 at 15:15

1 Answers1

0

I've figured out my problem. What I was looking for doesn't exist. Google doesn't already generate credentials when the app is installed from the G-Suite marketplace, unless you use a service account. Presumably you have to authorize the user yourself the first time he uses your app.