B4i Library Sign in with Apple and Firebase

If you want to authenticate without Firebase: https://www.b4x.com/android/forum/threads/user-authentication-with-apple-id.113671/#content

Make sure to use latest version of Firebase: https://www.b4x.com/android/forum/threads/firebase-2-50-april-2020.116278/

It will only work with iOS 13. Most iOS devices run iOS 13+.

Configuration:
0. Configure FirebaseAuth as explained here: https://www.b4x.com/android/forum/t...ate-your-users-google-facebook.68625/#content
1. Enable 'Sign In With Apple' in the app identifier page in Apple developer console. The app id must be a non-wildcard id.
2. Download an updated provision profile and set it with:
B4X:
#ProvisionFile: xxx.mobileprovision

3. Add to main module:
B4X:
#AdditionalLib: AuthenticationServices.framework
#MinVersion: 13
#Entitlement: <key>com.apple.developer.applesignin</key><array><string>Default</string></array>

4. Add the class to your project and add the custom view - AppleAuthButton. It depends on iXUI library.
5. Enable Apple in Firebase console, under Authentication - Sign-in method.

When the user signs in the Auth_SignedIn event will be raised. Note that the name is likely to be empty. The email might be an anonymized email, based on the user selection.

Note that this class is different than the class from the previous tutorial.

Updates:

v1.01 - Adds Auth_Error event inside the class.
 

Attachments

  • AppleAuthButton.bas
    7.2 KB · Views: 33
Last edited:

nobbi59

Active Member
Licensed User
Longtime User
I cant figure out what event is being raised. The Button has no Event and the OBJC Code doesnt seem to call an event.

I assume its the Event of a FirebaseAuth Object but it is not being called for me. Am I missing something here?
 

nikitaganco

Member
Licensed User
hello, trying to implement this version of Sign In With Apple Id with Firebase, but when I sign-in to app i've got the following error:
"signInWithCredential, error = (null)"
and no event has been rised

what can I do ?
 

nikitaganco

Member
Licensed User
Hello, W/O Firebase it's working fine, but please describe do I need to show this button every time app starts or there is possible to check that user is sill signed in w/o showing this button?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
but please describe do I need to show this button every time app starts or there is possible to check that user is sill signed in w/o showing this button?
Please start a new thread for any question you have.

The only thing that I can say about the error, is that something is misconfigured with Firebase.
 

nikitaganco

Member
Licensed User
thank you, well i found in Firebase console, under Apple authentication is written : " To complete setup, add this authorisation callback URL to your app configuration in the Apple Developer Console. " and specified one url like "https:/xxxxxxxxxxxx.firebaseapp.com/__/auth/handler" . Ok please help me with this because I do not know where to find "app configuration in the Apple Developer Console", there no such menu like "app configuration". There is "Certificates, Identifiers & Profiles" bt no app configuration.
 
D

Deleted member 103

Guest
When the user signs in the Auth_SignedIn event will be raised. Note that the name is likely to be empty. The email might be an anonymized email, based on the user selection.
Hi Erel,
do you know whether the user gets the same "anonymized email" when he logs on from a second device?
 
D

Deleted member 103

Guest
I don't think so. At least it is not documented.

However the user id should be the same.
Thank you Erel for your answer.
Unfortunately, I only have an iphone with ios13 and therefore cannot test whether the id remains the same.
 
Top