MrStahlfelge/gdx-gamesvcs

Google Play Games Dektop

SimonIT opened this issue · 9 comments

Hello,

I've integrated gdx-gamesvcs with Google Play Games in my project and it works on android. But on desktop, I'm getting this messages on start:

Feb 09, 2018 12:52:05 PM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNUNG: unable to change permissions for everybody: C:\Users\simon\.store\Turban Guy
Feb 09, 2018 12:52:05 PM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNUNG: unable to change permissions for owner: C:\Users\simon\.store\Turban Guy

And this messages when I try to log in:
gsShowErrorToUser errorLoginFailed Request to Google API failed.

I'm using gamesvcsVersion 0.2.2 and gdxVersion 1.9.8.
Thanks for your help.

Hi, warnings are not an issue, it should work. Maybe your problem is elsewhere.

Could you log the exception stacktrace as well (the exception you get from gsShowErrorToUser) to see what's really happens ?

This is the exception:
com.google.api.client.auth.oauth2.TokenResponseException: 401 Unauthorized at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105) at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287) at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307) at com.google.api.client.auth.oauth2.Credential.executeRefreshToken(Credential.java:570) at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489) at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:217) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469) at de.golfgl.gdxgamesvcs.GpgsClient.waitForUserAuthorization(GpgsClient.java:265) at de.golfgl.gdxgamesvcs.GpgsClient.access$100(GpgsClient.java:67) at de.golfgl.gdxgamesvcs.GpgsClient$2.run(GpgsClient.java:305) at java.lang.Thread.run(Thread.java:748)

This is the code from DesktopLauncher:
new LwjglApplication(new TurbanGuyGame() { @Override public void create() { gsClient = new GpgsClient().initialize("Turban Guy", Gdx.files.internal("gpgs-client_secret.json"), true); super.create(); } }, config);

The gpgs-client_secret.json looks like this:
{ "installed": { "client_id": "ID", "project_id": "ID", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://accounts.google.com/o/oauth2/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_secret": "Secret", "redirect_uris": [ "urn:ietf:wg:oauth:2.0:oob", "http://localhost" ] } }

I've downloaded the JSON from https://console.developers.google.com/apis/credentials/oauthclient
I changed the client_id, project_id and client_scecret before posting

please read the javadoc here : https://github.com/MrStahlfelge/gdx-gamesvcs/blob/master/desktop-gpgs/src/de/golfgl/gdxgamesvcs/GpgsClient.java#L184

your json structure just needs client_id and client_secret, maybe the extra configuration is messing up ?

another thing, are your sure you selected "application type" : "other" when you created the credentials and not "web application" or "android application" ? actually you need 2 of them : one for android (type android) and another for desktop (type other)

It changes nothing, now this is the json:
{ "installed": { "client_id": "ID", "client_secret": "ID" } }
Yes, I have the two types
unbenannt

and about the OAuth type ?

Yes (see the last answer)

did you cleared your Oauth token (removed the local file in /.store/Turban Guy) to re-authorize again throw your browser after changing the credentials ?

After clearing the Oauth token is it working, thanks

Cool ! you can close the issue then ;-)