def oauth_alert(): """ Show an OAuth alert to start authentication process. """ context = make_context() credentials = get_credentials() if credentials: resp = authomatic.access(credentials, "https://www.googleapis.com/oauth2/v1/userinfo?alt=json") if resp.status == 200: context["email"] = resp.data["email"] return render_template("oauth/oauth.html", **context)
def oauth_alert(): """ Show an OAuth alert to start authentication process. """ context = make_context() credentials = get_credentials() if credentials: resp = authomatic.access( credentials, 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json') if resp.status == 200: context['email'] = resp.data['email'] return render_template('oauth/oauth.html', **context)
def oauth_alert(): """ Show an OAuth alert to start authentication process. """ context = make_context() if not _has_api_credentials(): return render_template('oauth/warning.html', **context) credentials = get_credentials() if credentials: resp = authomatic.access(credentials, 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json') if resp.status == 200: context['email'] = resp.data['email'] return render_template('oauth/oauth.html', **context)