I am using PAW to try and test different cloud functions deployed with Firebase. The app uses phone authentication, however currently there is little to no documentation on how to accomplish phone number authentication via REST API.
I have whitelisted a phone number for testing as per instructions here.
It appears that what I need to do is call on the verifyPhoneNumber
method, which I have pieced together that the REST API endpoint I need is in the format:
https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPhoneNumber?key={WEB_API_KEY}
Now where I get stuck is in trying to pass the data that is expected. It looks like this endpoint expects a phoneNumber
and an applicationVerifier
object. I've pieced this together from the corresponding documentation here.
I try to make a request that looks like:
POST /identitytoolkit/v3/relyingparty/verifyPhoneNumber?key={WEB_API_KEY}
Content-Type: application/json; charset=utf-8
Host: www.googleapis.com
Connection: close
User-Agent: Paw/3.1.7 (Macintosh; OS X/10.13.6) GCDHTTPRequest
Content-Length: 73
{"phoneNumber":"+18035551111","applicationVerifier":{"type":"recaptcha"}}
The response I receive is:
HTTP/1.1 400 Bad Request
Vary: X-Origin
Vary: Referer
Content-Type: application/json; charset=UTF-8
Date: Thu, 13 Sep 2018 16:35:33 GMT
Server: ESF
Cache-Control: private
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Connection: close
{
"error": {
"code": 400,
"message": "MISSING_SESSION_INFO",
"errors": [
{
"message": "MISSING_SESSION_INFO",
"domain": "global",
"reason": "invalid"
}
]
}
}
I'm not sure what I'm doing wrong at this point as I'm running out of documentation and sort of just blindly guessing parameters now. How can I authenticate via white-listed phone number via REST API for testing?