android - get_current_user() returns None due to "Audience not allowed" warning in Cloud Endpoints -


Receiving a "audience is not allowed" warning in my Google Developer Console log when authenticated via Google Cloud Endpoint with Android app while trying to make a request

are viewing through endpoint source code, which is compatible with:

  aud = parsed_token.get ('aud') cid = parsed_token.get 'esp ') If the odd! = CID and OAD are not in the audience: logging. Warning (My audience code in the android app: 'Audiences are not allowed:% s', Audi)  

/ P>

  public static final string WEB_CLIENT_ID = "web -client-id.apps.googleusercontent.com "; Public static final string AUDIENCE = "server: client_id:" + WEB_CLIENT_ID; GoogleAccountCredential Credential = GoogleAccountCredential.using Authority (mContext, AUDIENCE); Graphics. Manufacturer Maker = New Graphics Manufacturer (HTTP_TRANSPORT, JSON_FACTORY, Credential); Grapi service = builder.build ()  

Where "web-client-id" is the alpha numeric client id generated in the Google Developer Console. This service is used to make a certified call.

This is the same WEB_CLIENT_ID that has been passed to the AP decorator in my backend python code:

  WEB_CLIENT_ID = 'web-client-id.apps.googleusercontent.com 'ANDROID_CLIENT_ID.com' ANDROID_AUDIENCE = WEB_CLIENT_ID grapi_client_ids = [ANDROID_CLIENT_ID, WEB_CLIENT_ID] endpoints.API_EXPLORER_CLIENT_ID] [grapi_audiences = [ANDROID_AUDIENCE] @ endpoint.ipi (name = 'grapi', version = 'v1', allowed_client_ids = grapi_client_ids, audiences = grapi_audiences, scopes = [Endpoints.EMAIL_SCOPE])  

It seems that all this is causing endpoints.get_current_user () to return no one else, and fail to get my certified call.

When I started my web client ID and Android, the client id variable in the Dragon backend, Use backslash for PEP8 (80 character line length) i.e.

  WEB_CLIENT_ID = 'web-client-id' \ '.apps.googleusercontent.com' ANDROID_CLIENT_ID = 'android-client-id' \ '. .apps.googleusercontent.com ' 

I'm not sure why it was not read properly, but when I used line continuation inside the bracket, it works fine.

  WEB_CLIENT_ID = ('web-client-id' '.apps.googleusercontent.com') ANDROID_CLIENT_ID = ('android-client-id' '.apps.googleusercontent.com')  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -