[google-oauth] Get user information

I tried the flow until user information is acquired by API

from oauth2client.client import flow_from_clientsecrets
from apiclient.discovery import build
import webbrowser
import httplib2
flow = flow_from_clientsecrets('./oauth2.json',
                                scope='openid',
                                redirect_uri='http://localhost:8080')
url_l = flow.step1_get_authorize_url()
webbrowser.open(url_l)

##Code of the URL displayed in the browser=###Copy

code = '######'
cre = flow.step2_exchange(code)
http = cre.authorize(httplib2.Http())
service = build('oauth2','v2',http=http)
a = service.userinfo().get().execute()

One paragraph because I confirmed that a has user information. The instance of the Resource object created by build does not work unless it is executed. I don't know what I'm doing internally, but it doesn't seem to have a static function I used iPython, but no candidates came out. Next is the user management method and logout control method.

Compared to programs that only process data locally Why is a web app a hassle?

Recommended Posts

[google-oauth] Get user information
[Linux] Get Linux resource information
[Python] Get user information and article information with Qiita API
Get information with zabbix api
Get GitHub information using PyGithub
Get Alembic information with Python
Get video file information with ffmpeg-python
Get Redmine User list with DataFrame
Get weather information with Python & scraping
Get delay information on Twitter and tweet
Get BITCOIN LTP information with Raspberry PI
[Python] Get Python package information with PyPI API
Output user information etc. to Django log
Get coincheck virtual currency information with API ♪