コード例 #1
0
def google_token_callback():
    oauth_map = OAuthMap.get_by_id_safe(request.values.get("oauth_map_id"))

    if not oauth_map:
        return oauth_error_response(OAuthError("Unable to find OAuthMap by id."))

    if oauth_map.google_verification_code:
        return oauth_error_response(OAuthError("Request token already has google verification code."))

    oauth_map.google_verification_code = request.values.get("oauth_verifier")

    try:
        oauth_map = retrieve_google_access_token(oauth_map)
    except OAuthBadRequestError, e:
        return pretty_error_response('Unable to log in with Google.')
コード例 #2
0
def facebook_token_callback():
    oauth_map = OAuthMap.get_by_id_safe(request.values.get("oauth_map_id"))

    if not oauth_map:
        return oauth_error_response(OAuthError("Unable to find OAuthMap by id."))

    if oauth_map.facebook_authorization_code:
        return oauth_error_response(OAuthError("Request token already has facebook authorization code."))

    oauth_map.facebook_authorization_code = request.values.get("code")

    try:
        oauth_map = retrieve_facebook_access_token(oauth_map)
    except OAuthBadRequestError, e:
        return pretty_error_response("Unable to log in with Facebook.")
コード例 #3
0
def google_token_callback():
    oauth_map = OAuthMap.get_by_id_safe(request.values.get("oauth_map_id"))

    if not oauth_map:
        return oauth_error_response(
            OAuthError("Unable to find OAuthMap by id."))

    if oauth_map.google_verification_code:
        return oauth_error_response(
            OAuthError("Request token already has google verification code."))

    oauth_map.google_verification_code = request.values.get("oauth_verifier")

    try:
        oauth_map = retrieve_google_access_token(oauth_map)
    except OAuthBadRequestError, e:
        return pretty_error_response('Unable to log in with Google.')
コード例 #4
0
def facebook_token_callback():
    oauth_map = OAuthMap.get_by_id_safe(request.values.get("oauth_map_id"))

    if not oauth_map:
        return oauth_error_response(OAuthError(
                "Unable to find OAuthMap by id."))

    if oauth_map.facebook_authorization_code:
        return oauth_error_response(OAuthError(
                "Request token already has facebook authorization code."))

    oauth_map.facebook_authorization_code = request.values.get("code")

    try:
        oauth_map = retrieve_facebook_access_token(oauth_map)
    except OAuthBadRequestError, e:
        return pretty_error_response('Unable to log in with Facebook.')