I followed the example https://developer.android.com/google/gcm/notifications.html#gen-client , trying to create a notification key from the client.
The getAccounts () method did return a valid google account. GoogleAuthUtil.getToken (context, account name, scope) also returns a valid scope string. However, the response from the message at https://android.googleapis.com/gcm/googlenotification is 401 and is an html page:
<HTML> <HEAD> <TITLE>Unauthorized</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Unauthorized</H1> <H2>Error 401</H2> </BODY> </HTML>
Logcat shows this: 10-14 13: 26: 03.911: W / DefaultRequestDirector (22125): Authentication failed: Unable to answer any of these problems: {}
I double checked ip filtering, it shows: IPS Any IP address is allowed.
Want to know if this is a known issue, or does anyone know?
FYI I was able to get id_token from GoogleAuthUtil.getToken. this is the http mail format that I followed: Http post body: {"operation": "add", "notification_key_name": "appUser-Chris", "registration_id": ["4"] "id_token": "id_token"} headers: content-type: "application / json" Header: "project_id": Thanks!
source share