2
votes

I'm following the steps described in google doc: 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: 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.

1

1 Answers

1
votes

It seems that firebase team fixed it. I've just tried to send to firebase newly created VAPID registration and got the long token as a response.