8000 GitHub - maufia/google-oauth2: Google oauth2 credential using Flask
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

maufia/google-oauth2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-oauth2

Google oauth2 credential using Flask

Introduction

This code is used to test google's authentication/authorisation mechanism (Oauth2).

The code only retrieves userinfo profile, which can be used for authenticate the user to another service.

Source

The code was modified from Google's own documents

Preparation

Create client_secret.json from API manager and credential from Your own Google console

Note that the scopes are listed in Google developers protocols

The returned values can be configured in Google developers API explorer

Full documentation is available in Google developers API library

Preparation

The code is best tested by creating a virtual environment with python3 and pip3 (tested with 3.4).

$ cd google-oauth2/api
$ python3 -m virtualenv venv
$ venv/bin/pip3 install --upgrade flask
$ venv/bin/pip3 install --upgrade google-api-python-client

The file client-secret.json needs to be copied in the api/secrets/ directory.

Run the script

$ venv/bin/python3 get_oauth2_credential.py

On a browser go to the address localhost:5000

Result

The userinfo are returned to the browser. it works!

Licence

Google distributed its code with a Apache2.0 licence, which I've kept.

About

Google oauth2 credential using Flask

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0