Hi everyone, I'm currently working on an ABMaterial web app and I am using this library (class) found here so far I have used this in a few other projects and I like it very much as it makes it simple to leverage the use of firestore sign in, sign up and firestore database functions.
I am seeing an issue at the moment that I can't figure out why it's happening, If I run the project on my local pc everything works as expected, but when I run the project from a VPS I see an issue when I try to use the sendEmailVerification function.
The problem I am seeing is that I get the following error:
From looking at the error I know it's easy to assume that I am missing the REQ_TYPE, but I am not, the following is the code that gets executed when running the sendEmailVerification function.
And here's the code where that function is called:
This is the Json string being sent, as you can also see from there the "VERIFY_EMAIL" requestType is included on there.
As you can see the REQ_TYPE is being passed as the first parameter as "VERIFY_EMAIL" which according to the documentation that's what it should be when using this function.
As I mentioned this works fine when I run the web app on my local PC, but I receive the above error when running it from my VPS.
Does anyone have any idea or experienced with this library and that can provide some feedback?
Walter
I am seeing an issue at the moment that I can't figure out why it's happening, If I run the project on my local pc everything works as expected, but when I run the project from a VPS I see an issue when I try to use the sendEmailVerification function.
The problem I am seeing is that I get the following error:
Response Error:
}
ResponseError. Reason: , Response: {
"error": {
"code": 400,
"message": "MISSING_REQ_TYPE",
"errors": [
{
"message": "MISSING_REQ_TYPE",
"domain": "global",
"reason": "invalid"
}
]
}
}
From looking at the error I know it's easy to assume that I am missing the REQ_TYPE, but I am not, the following is the code that gets executed when running the sendEmailVerification function.
sendEmailVerification:
'Send email verification
'https://firebase.google.com/docs/reference/rest/auth#section-send-email-verification
'requestType - The type of confirmation code to send. Should always be "VERIFY_EMAIL".
'idToken - The Firebase ID token of the user to verify.
Public Sub sendEmailVerification(requestType As String,idToken As String) As ResumableSub
Dim url As String = $"https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${API_KEY}"$
'''https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=[API_KEY]
Dim json As JSONGenerator
json.Initialize(CreateMap("requestType":requestType,"idToken":idToken))
Log("emailverification json: " & json.ToPrettyString(3))
Dim j As HttpJob : j.Initialize("",Me)
'''j.PostString(url,json.ToString)
j.PostBytes(url, json.ToString.GetBytes("UTF-8"))
j.GetRequest.SetContentType("application/json")
j.GetRequest.SetHeader("requestType", requestType)
Wait For (j) JobDone(j As HttpJob)
Return GenerateResult(j)
#If Documentation
requestType - The type of confirmation code to send. Should always be "VERIFY_EMAIL".
idToken - The Firebase ID token of the user to verify.
#End If
End Sub
And here's the code where that function is called:
sendEmailVerification call:
wait for (authRest.sendEmailVerification("VERIFY_EMAIL", ABMShared.tokenID)) Complete(Result As Map)
This is the Json string being sent, as you can also see from there the "VERIFY_EMAIL" requestType is included on there.
Json String for request:
emailverification json: {
"requestType": "VERIFY_EMAIL",
"idToken": "eyJhbGciOiJSUzI1NiIs....
}
As you can see the REQ_TYPE is being passed as the first parameter as "VERIFY_EMAIL" which according to the documentation that's what it should be when using this function.
As I mentioned this works fine when I run the web app on my local PC, but I receive the above error when running it from my VPS.
Does anyone have any idea or experienced with this library and that can provide some feedback?
Walter