1

I am using Python on the Google App Engine. I have gotten sign-in with google to work to generate an OAuth token. Then, I can use that token to access the user's profile from datastore, but I can't seem to find anything on how to sign in with a username and password to generate an OAuth token. Is there a way to do this?

1
  • 1
    Did you check out the official docs ? Commented Dec 31, 2015 at 23:38

1 Answer 1

1

It looks like your question is 'How to I use my own username and password scheme to generate an OAuth token'. The short answer is that you can't, because Google OAuth only works with Google logins. The Google OAuth token is good for Google APIs, and there's no way to tell Google how to recognize your usernames for the purposes of authentication.

The longer answer is that you can use your own authentication scheme separately from Google sign-in if you want to give users that option. You could use any number of third party libraries to do this or roll your own. These users won't have access to Google's APIs that require authentication though (such as the Users API) so you'll have to devise a way to keep those user's data separate from each other, and use a service account or application default credentials to access any external Google APIs on behalf of those users.

This kind of question does seem to pop up sporadically on Stack Overflow which may provide some other suggestions for how to implement this.

Sign up to request clarification or add additional context in comments.

2 Comments

So if I understand this correctly, I only need to use Google OAuth if I want to access something like Google Search or Google Translate (Google APIs), but if I don't need access to them and only need to access my own datastore, then there is no need for Google OAuth. This way I could have my own username and hashed password stored in datastore, and then have the user login with that username and password.
That's essentially it except of course it's also used for some built-in App Engine APIs as well such as the Users API - cloud.google.com/appengine/docs/python/users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.