谷歌的新帐户+登录

时间:2014-03-13 09:02:45

标签: python api google-plus google-oauth

我能够通过Google+ Api

将帐户与我的网站相关联

我遇到问题的一件事是:

  1. 当用户在我创建的api应用中链接他的新帐户(通过尚未登录的Google+社交网络)时
  2. 系统会指示用户创建Google+个人资料屏幕。
  3. 当按下提交按钮时,它被定向到一个URL,然后它不再加载,使屏幕空白而不知道用户的帐户是否是在谷歌+中创建的。
  4. 问题:有没有办法在代码中添加或确定用户是否未在Google +中创建帐户?

    另一个问题是当该帐户是链接时,它会在浏览器中记录但显示错误"Failed to upgrade the authorization code"

    当我调试我的代码时,它在流认证中出错:

    try:
        # Upgrade the authorization code into a credentials object
        oauth_flow = flow_from_clientsecrets(os.getcwd()+path+'client_secrets.json', scope='')
        oauth_flow.redirect_uri = 'postmessage'
        credentials = oauth_flow.step2_exchange(code)
    except FlowExchangeError:
        return 'Failed to upgrade the authorization code.'
    

    以下是我视图中传递的参数:

    <meta name="google-signin-scope" content="https://www.googleapis.com/auth/plus.login" />
    <meta name="google-signin-requestvisibleactions" content="http://schemas.google.com/AddActivity" />
    <meta name="google-signin-cookiepolicy" content="single_host_origin" />
    

    问题与参数有关吗?可能是什么问题?

    问题与这个问题有关。 Issue with Google+ upgrade via OAuth2 and multiple sign-in

    client_secrets.json

    { "web":
      { "client_id": "1314.....googleusercontent.com",
        "client_secret": "Se8....",
        "client_email": "1314...@developer.gserviceaccount.com",
        "redirect_uris": [ "postmessage"],
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://accounts.google.com/o/oauth2/token"
      }
    }
    

    希望得到你的帮助。谢谢。

0 个答案:

没有答案