我想产生服务器权威性代码安卓登录谷歌服务器
gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestScopes(new Scope(Scopes.DRIVE_APPFOLDER))
.requestServerAuthCode(getString(R.string.server_client_id), false)
.build();
然后我试图让这样的服务器授权的代码。
result.requestServerAuthCode(getString(R.string.server_client_id), false)
假设我得到了像'bla bla bla'这样的认证标志;
然后使用laravel社交名媛,我试图让用户在服务器端
Socialize::driver('google')->userFromToken('bla bla bla')
它显示了我错误
GuzzleHttp\Exception\ClientException with message 'Client error: GET https://www.googleapis.com/plus/v1/people/me?prettyPrint=false resulted in a 401 Unauthorized` response: {"error":{"errors":[{"domain":"global","reason":"authError","message":"Invalid Credentials","locationType":"header","loc (truncated...)
使用该授权码来获得访问令牌,见https://developers.google.com/identity/protocols/OAuth2,然后使用访问该端点的令牌 – BNK
Thankyou进行回复!我正在网上寻找。你可以告诉我如何从php获取access_token或简单地卷曲@BNK –
对不起,我不熟悉PHP和卷曲,但是,我认为你可以在https://github.com/google/google-api-php找到更多信息。客户端和http://stackoverflow.com/questions/28390718/not-able-to-fetch-google-oauth-2-0-access-token – BNK