def register(): access_token = request.values.get("access_token", None) if not access_token or access_token == "None": return render_template("google_contacts_app/register.html") token = oauth.OAuthToken.from_string(urllib.unquote(access_token)) logger.debug('access_token: %s || secret: %s', token.key, token.secret) auth = GoogleContacts(GOOGLE_OAUTH_CONSUMER_KEY, GOOGLE_OAUTH_CONSUMER_SECRET, str(token.key), str(token.secret)) try: profile = auth.get_profile() except Exception, e: logger.debug("authentication error: %r", e) flash("There was a problem authenticating you with Google. Please try again.", "error") return render_template("google_contacts_app/register.html")