Unexpected response code 403 for https://www.googleapis.com/games/v1/players/1123xxxxxx11712506520 and other play-services errors

∥☆過路亽.° 提交于 2019-12-23 07:51:42

问题


I'm trying to make games API work, with reference to https://github.com/playgameservices/android-samples/blob/master/BaseGameUtils/src/com/google/example/games/basegameutils/BaseGameActivity.java as sample code.

Mine is quite similar, basically I'm trying to connect a game client and receive a negative answer. When trying to manage it with startResolutionForResult() this is what I got:

  E/Volley(15638): [1492] il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/112370814111712506xxx
  E/Volley(15638): [1492] il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/112370814111712506xxx
  E/SignInIntentService(15638): Access Not Configured
  [...]
   E/LoadSelfFragment(15748): Unable to sign in - application does not have a registered client ID

The last message, "application does not have a registered client ID" made me think to this question...But I don't think my issue is related to app id / client ID as I got it working with same API keys on another machine. I'm pretty sure of SHA1 correctness, too, derived from current machine's debug.keystore.

The issue seems to be related to test address I'm using, the strange thing is that I don't receive always the same reply: using same keys and settings, I sometimes got:

 E/SignInIntentService(15638): Access Not Configured

or even:

  E/SignInIntentService(15638): Unable to load player

I'm using startResolutionForResult() inside OnConnectionFailedListener, it's showing the log-in screen briefly, but then it crashes with reported errors.

  • Another strange thing is that onActivityResult() is called, and result code is 10004

  • A last thing I can't understand is why, after an unsuccessful sign-in, the method onConnectionFailed() is called over and over, looping my app. Relevant code is:

    public void initClient() {
            GamesClient.Builder gcBuilder = new GamesClient.Builder(this, cb, cf);
    gcBuilder.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    //gcBuilder.setScopes(mScopes);
    mGamelient = gcBuilder.create();
    mSchiacciameleView.setGameClient(gcBuilder.create());
    }
    
     OnConnectionFailedListener cf = new OnConnectionFailedListener() {
    public void onConnectionFailed(ConnectionResult arg0) {
        Log.e("Verme", "CONN FAIL:" + arg0.getErrorCode());
        if (arg0.hasResolution()){
            PendingIntent pendingIntent = arg0.getResolution();
            //startResolutionForResult(SchiacciaMeleGame.this, 66);
            try {
                arg0.startResolutionForResult(me, ConnectionResult.SIGN_IN_REQUIRED) ;
            } catch (SendIntentException e) {
                Log.e("Verme", "Err in resolution", e);
            }
        }else{
            Log.e("Verme", "NO RESOLUTION");
        }
    
    }
    

    };

I've been messing with these libraries for two days. Frankly, I don't like the way Google is managing this; documentation is still incomplete and run-time behaviour seems a bit inconsistent (the exact same code is working on another machine, SHA1 is correct on both). Maybe it's my fault?

Thank you for replies


回答1:


In Step 3. Generate an OAuth 2.0 client ID it specifically gives a warning as follows:

Warning: Do not open the Google APIs Console directly and manually add your Client IDs on that page. Doing so might cause errors when you send requests to the game services.

So my experience was that you need to follow the guide religiously: Setting Up Google Play Game Services with the Google Play Developer Console



来源:https://stackoverflow.com/questions/16688029/unexpected-response-code-403-for-https-www-googleapis-com-games-v1-players-112

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!