Android Question Firebase Auth - emailVerified

Blueforcer

Well-Known Member
Licensed User
Longtime User
Good Morning,

im using the B4J Library [B4X] Firebase Auth REST API from @Alexander Stolte. Ive implemented it into my jServer backend for my App login process.

When the user registers, I start signUpEmailPW and if that works, then immediately sendEmailVerification.
The email also arrives. However, I can also log in without having clicked on the link.
In the signInEmailPW method I get no information in the response map about whether the user is verified or not.
Where can I find this information? What would be the correct workflow?

p.s. I use firebase directly to send and verify emails. So the email link is like
https://myAppName.firebaseapp.com/__/auth/action?mode=action&oobCode=code
 

Alexander Stolte

Expert
Licensed User
Longtime User

and to get the emailVerified property with the rest api, call this:
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
ive added a new function to the libary to get the userdata wich contains emailVerified. Maybe you can add it in a future update
edit: Hehe, answered at the same time :)

B4X:
'Get Userdata
'https://cloud.google.com/identity-platform/docs/use-rest-api?hl=de#section-get-account-info
'idToken - The Firebase ID token of the user to delete.
Public Sub getUserData(idToken As String) As ResumableSub
    Dim url As String = $"https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=${API_KEY}"$
    Dim json As JSONGenerator
    json.Initialize(CreateMap("idToken":idToken))
    Dim j As HttpJob : j.Initialize("",Me)
    j.PostString(url,json.ToString)
    j.GetRequest.SetContentType("application/json")
    Wait For (j) JobDone(j As HttpJob)
    Return GenerateResult(j)
    #If Documentation
        localId - The uid of the current user.
        email - The email of the account.
        emailVerified - Whether or not the account's email has been verified.
        displayName - The display name for the account.
        providerUserInfo - List of all linked provider objects which contain "providerId" and "federatedId".
        photoUrl - The photo Url for the account.
        passwordHash - Hash version of password.
        passwordUpdatedAt -    The timestamp, in milliseconds, that the account password was last changed.
        validSince - The timestamp, in seconds, which marks a boundary, before which Identity Platform ID tokens are considered revoked.
        disabled - Whether the account is disabled or not.
        lastLoginAt - The timestamp, in milliseconds, that the account last logged in at.
        createdAt - The timestamp, in milliseconds, that the account was created at.
        customAuth - Whether the account is authenticated by the developer.
        tenantId - The tenant ID of the user. Only returned in multi-tenancy.viderId" and "federatedId".
        emailVerified - Whether or not the account's email has been verified.
        #End If
End Sub
 
Upvote 0
Top