Cloud endpoints authentication failure in android app

后端 未结 3 688
渐次进展
渐次进展 2021-01-19 13:19

I\'m having trouble with my first attempt to use authentication in debug mode in a Google Cloud Endpoints android app. I set up credentials like this:

creden         


        
3条回答
  •  借酒劲吻你
    2021-01-19 14:08

    Maybe you have the wrong Certificate fingerprint (SHA1) for your Android Client-Id? The authentication with the fingerprint of your production key works only if you sign the .apk manually.

    Register a Client-Id for an Installed Application (Android) with your debug.keystore fingerprint in your API Console. To get the fingerprint use:

    C:\>keytool -list -alias androiddebugkey -keystore C:\.android\debug.keystore -storepass android -keypass android
    

    Also you need a Web-Client-Id and set it as Audience in your Android application:

    credential = GoogleAccountCredential.usingAudience(this,"server:client_id:" + WEB_CLIENT_ID);
    

    AppEngine Endpoint configuration should look like this:

    @Api(
        name = "testEndpoint",
        version = "v1",
        clientIds = {ClientIds.WEB_ID, ClientIds.ANDROID_PRODUCTION_ID, ClientIds.ANDROID_DEBUG_ID},
        audiences = {ClientIds.WEB_ID}
    

    )

提交回复
热议问题