Skip to content

Remove oauth2client usage in endpoints samples#1002

Merged
theacodes merged 2 commits intomasterfrom
endpoints-to-google-auth
Jun 26, 2017
Merged

Remove oauth2client usage in endpoints samples#1002
theacodes merged 2 commits intomasterfrom
endpoints-to-google-auth

Conversation

@theacodes
Copy link
Copy Markdown
Contributor

No description provided.

@theacodes theacodes requested a review from andrewsg June 26, 2017 17:27
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 26, 2017
@theacodes theacodes force-pushed the endpoints-to-google-auth branch 2 times, most recently from 2cb5844 to 5397897 Compare June 26, 2017 17:58
def get_id_token(client_secrets_file, extra_args):
storage = oauth2client.file.Storage('credentials.dat')
credentials = storage.get()
"""Obtains credentials form the user using OAuth 2.0 and then returns the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo here (should be "from")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. :)

import oauth2client.client
import oauth2client.file
import oauth2client.tools
import google_auth_oauthlib.flow
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be accurate, but just out of curiosity, why is google.auth a thing and google_auth also a thing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Two reasons:

  1. We wanted to get google.auth to a v1.0.0 interface as quickly as possible to avoid thrashing. To do this, we descoped several contentious features from the library. We split the "User Auth" featureset into a separate library, google-auth-oauthlib, in order to be able to iterate without worrying about breaking the v1.0.0 interface of google-auth. Once that separate library has a solid interface, we can merge it into google-auth as a 1.x feature.
  2. We didn't want to make google.auth a namespace package because when we do promote the auxiliary packages we do not break existing code using the separate version. So the auxiliary packages like google-auth-oauthlib must use a new global top-level namespace, in this case google_auth_oauthlib.

@theacodes theacodes merged commit f21866f into master Jun 26, 2017
@theacodes theacodes deleted the endpoints-to-google-auth branch June 26, 2017 20:44
@viktorLisniak
Copy link
Copy Markdown

generated jwt worked when i added "scope":"https://www.googleapis.com/auth/admin.directory..." to payload.
maybe it should be there from the beginning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants