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