iOS Question Firebase Auth - Get Facebook Birthdate

Status
Not open for further replies.

tufanv

Expert
Licensed User
Longtime User
Hello,

Is it possible to get facebook profile's birthdate and gender after logging in with facebook ?

Thanks
 

JanPRO

Well-Known Member
Licensed User
Longtime User
Sorry, I was not 100% correct.
The gender doesn't require a extra review, you can use the following code:

B4X:
Sub RequestGender
    Dim NaObj As NativeObject
    NaObj = NaObj.Initialize("FBSDKAccessToken")
    Dim Token As String = NaObj.RunMethod("currentAccessToken",Null).GetField("tokenString").AsString
    Dim Url As String = $"https://graph.facebook.com/v2.8/me?fields=gender&access_token=${Token}"$
   
    Dim API As HttpJob
    API.Initialize("API",Me)
    API.Download(Url)
End Sub

Sub JobDone (J As HttpJob)
    If J.JobName = "API" Then
        Dim JSON As JSONParser
        JSON.Initialize(J.GetString)
        Dim Gender As String = JSON.NextObject.Get("gender")
        Log("Gender : " & Gender)
    End If
End Sub

Jan
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Hello tufanv,

Do you have success to creating a function to login via facebook authentication?

Can you share?

Because for me it´s not working the firebase sample from Erel.

Thank you

Alberto Iglesias

Dear Alberto,

I used firebase auth to login with facebook in one of my projects without any problem. I had followed Erel's example. At what stage you are having problem ?
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
No I am talking about the code. The code seems correct however clicking on sign in with facebook crashes the app . I can't connect to b4i bridge that's why I can't check the error .
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
You can still get to see the screen and click the button.

I can not even see the screen, the error already occurs, just when initializing the "auth"

It welcomed me with my name at first start but i dont know if it logged in with google or fb . I clicked sign out then clicked on fb again and it crashed. I cant connect to b4i bridge to debug, I have a problem. If i can solve it i will further check
 
Upvote 0
Status
Not open for further replies.
Top