import VAPID registrations into firebase asks for OAuth2

150 views
Skip to first unread message

Nikola Barac

unread,
Jun 27, 2018, 10:07:52 AM6/27/18
to Firebase Google Group
I'm following the steps described in google doc: https://developers.google.com/instance-id/reference/server#import_push_subscriptions and I'm getting the 401 error message when trying to import one VAPID registration via curl:

"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."

My request looks like this:

    curl -X POST -H "Authorization:key=hidden-authorization-key"
    -H "Content-Type:application/json"  
    -d @data.json https://iid.googleapis.com/v1/web/iid
   
And here is the data.json content

    {"endpoint": "https://fcm.googleapis.com/fcm/send/hidden-endpoint-hash",
    "keys": {
    "auth": "hidden-auth",
    "p256dh": "hidden-p256dh"}  
    }

Note: we used the same hidden-authorization-key when we were importing ios tokens via the batchImport endpoint described here: https://developers.google.com/instance-id/reference/server#create_registration_tokens_for_apns_tokens which worked as expected but the webpush import asks for OAuth2 which is strange since we are sending the Authorization:key.

Frank van Puffelen

unread,
Jun 27, 2018, 10:10:09 AM6/27/18
to Firebase Google Group
Reply all
Reply to author
Forward
0 new messages