Access to the server side with unambiguous cross-platform configuration

I'm having trouble understanding Android Google+ Sign in

I would like to support "login to Google" with server access for your application , and I would also like to support Cross-platform single sign . However, it is unclear whether I can really do this, as one uses GoogleApiClient.connect()and the other - GoogleAuthUtil.getToken().

If I try to use both parameters, GoogleAuthUtil.getToken()in order to get an offline token and GoogleApiClient.connect()for a single entry into the cross platform, the user twice asks for a permission screen. (I also have to set the server client identifier twice and the scope that the stitches are dumb)

Any ideas? Am I doing something wrong?

+4
source share
1 answer

The good news is that you would like to do this.

The reason you request permissions twice is because you are resolving client-side problems (problems GoogleApiClient.connect()) before problems with the solution server ( GoogleAuthUtil.getToken()) occur .

GoogleApiClient.connect()will only request permission if the user has not yet granted permission to your application. GoogleAuthUtil.getToken("oauth2:server:client_id:<server client-id>:api_scope:<scope1> <scope2>")will ask for permission every time because you are requesting offline access (update token) for your server.

, , , , , GoogleAuthUtil.getToken() ( ). , , GoogleApiClient.connect(), .

, :

http://www.riskcompletefailure.com/2013/10/google-android-client-server-sign-in.html

PlusClient, GoogleApiClient, .

+3

Source: https://habr.com/ru/post/1527842/


All Articles