google/oauth2l

Cannot generate refresh token with web app credentials - silent shut down.

Closed this issue · 2 comments

I'm folowing these guide trying to setup google ads api for my app.

  • I installed using the tar file, running on Linux.
  • I generated credentials for web app.

When I run:
oauth2l fetch --credentials credentials.json --scope adwords --output_format refresh_token
I'm getting url for user to auth, but after consent given, user redirected to url listed in credentials redirect_uri and cli shuts down without showing the response.
Contrary to #162 I'm not getting any errors, cli just stops without any result output to the console.

Solution was same as for #162 - generate desktop credentials instead of for web app.
I've struggled to narrow down problem as I was not getting any errors.

Why web credentials not working?
Well it's working partially, cause user getting redirected after consent screen and code is present in redirected url. There is just no follow up to getting refresh_token with that code.

Maybe good thing to do, is to add disclaimer in docs - that you need desktop credentials fro cli to work?

Thanks for the suggestion. Yes, adding a disclaimer is long overdue - I will take a look to see if I can do so today. For some more context: "Web credentials" from cloud console is intended for web-apps that requires redirect to specific web URL for handling the auth. OAuth2l only works with "Desktop credentials" from cloud console which is intended to redirect to localhost for completing the auth process (oauth2l creates a temporary server to listen on localhost for the redirect).

Documented in: #167