Skip to content

Add google auth#7

Open
tomasmor42 wants to merge 3 commits into
akasranjan005:masterfrom
tomasmor42:add-oauth
Open

Add google auth#7
tomasmor42 wants to merge 3 commits into
akasranjan005:masterfrom
tomasmor42:add-oauth

Conversation

@tomasmor42
Copy link
Copy Markdown

@tomasmor42 tomasmor42 commented Oct 13, 2019

#6

@akasranjan005
Copy link
Copy Markdown
Owner

can you update the code to maintain the structure of project in the below specified format:

  1. Authentication related code has to be in middleware directory
  2. the auth middleware imported in the main.py has to to be a decorator for easy readability & usage
  3. Auth middleware code should be well documented suggesting the configurable dependencies.

@tomasmor42
Copy link
Copy Markdown
Author

Updated according to the comments.

@akasranjan005 akasranjan005 requested a review from YJDave October 19, 2019 10:58
Copy link
Copy Markdown
Collaborator

@YJDave YJDave left a comment

Choose a reason for hiding this comment

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

@tomasmor42 Thank you for working on this.
The PR looks really good. Added minor suggestions, mostly documentation modification.
Also wanted to confirm whether you have tested this with google auth or not?

"BUNDLE_ERRORS": true
"BUNDLE_ERRORS": true,
"GOOGLE_OAUTH_CLIENT_ID":"123452-63456789234567v.apps.googleusercontent.com",
"GOOGLE_OAUTH_CLIENT_SECRET":"4rg7uj0p45tyj-oj"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If this is actual keys, please remove this from here and add any trash values with valid keys.

def get(self):
resp = google.get("/oauth2/v1/userinfo")
assert resp.ok, resp.text
return make_response(jsonify({'status': 'Success'})) No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should move this auth example in README file on in new section i.e. How to integrate google auth? with this code snippet and explanation.

def register_blueprint(app):
'''
This method creates and registers blueprint in application.
To create an OAuth with google you have to have GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET which you can
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

just a little addition to the comment .. GOOGLE_OAUTH_CLIENT_SECRET in your .json configuration file which you...

:return:
'''
blueprint = make_google_blueprint(scope=["profile", "email"])
app.register_blueprint(blueprint, url_prefix="/login") No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should also add note in README on url prefix for authentication, so if anyone wants to modify it is easy for them to trace and update.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants