Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: get_user_credentials doc to update no longer existing settings. #287

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions google_auth_oauthlib/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ def get_user_credentials(
you've provided.

To obtain the ``client_id`` and ``client_secret``, create an **OAuth
client ID** with application type **Other** from the `Credentials page on
client ID** with application type **Web Application** from the `Credentials page on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be a Desktop/Installed application type as well.

Maybe just remove the application type part from the comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't get it to work with Desktop/Installed Application, that's the main reason I submitted this pr.
Also I think the application type part is useful for newbies like me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the error you are running into for Desktop OAuth Client? I ran the below code and got a refresh token successfully. The client id and secret I used were of a Desktop Client.

import google_auth_oauthlib
from google.auth.transport.requests import Request

# TODO: Create a client ID for your project.
client_id = "<replace with client id>"
client_secret = "<replace with client secret>"
# TODO: Choose the needed scopes for your applications.
scopes = ["https://www.googleapis.com/auth/cloud-platform"]
cred = google_auth_oauthlib.get_user_credentials(
    scopes, client_id, client_secret
)

cred.refresh(Request())
print(cred.refresh_token)

the Google Developer's Console
<https://console.developers.google.com/apis/credentials>`_. Learn more
with the `Authenticating as an end user
<https://console.developers.google.com/apis/credentials>`_.
You may want to check the `OAuth 2.0 docs for Web Apps
<https://developers.google.com/identity/protocols/oauth2/web-server`_.
Learn more with the `Authenticating as an end user
<https://cloud.google.com/docs/authentication/end-user>`_ guide.

Args:
Expand Down