1

I have an app that uses authentication via FirebaseAuth which, when logging in, accesses the authentication website on github (where my app is registered) to authenticate. The callback works perfectly on both iOS and iPadOS. I am able to compile and run the app on MacOS as well, however, when I click to login, the safari browser launches, ask permission

"Do you want to allow this page to open <my app name>". 

I click "allow" but then I am taken back to my app running on MacOS which has a dialog pop up saying

Error, the interaction was cancelled by the user. 

Curious if anyone has experience with this and what I need to do so that my app can handle oauth on all 3 platforms.

Initialization code looks like this.

import FirebaseAuth
import Firebase
import FirebaseFirestoreSwift
import Alamofire

struct LoginScreen: View {
    @Binding var isLoggedIn : Bool
    @State var showErrorAlert = false
    @State var errorMessage : String = ""
    
    var db = Firestore.firestore()
    
    var provider = OAuthProvider(providerID: "github.com")
    
    var body: some View {
        VStack {
            Spacer()
            Image("octocat").resizable()
                .aspectRatio(contentMode: .fit).frame(maxWidth: 150)
                .alert(isPresented: $showErrorAlert, content: {
                    Alert(title: Text("Error"), message: Text(errorMessage), dismissButton: .default(Text("OK")))
                })
            Spacer()
            HStack {
                Spacer()
                Button {
                    provider.getCredentialWith(nil) { credential, error in
                        if let error = error {
                            errorMessage = error.localizedDescription
                            showErrorAlert = true

It is this error that gets triggered immediately after requesting the github auth URL.

Wondering if I need to authorize my app to make this URL call somehow?

Willeke
  • 14,578
  • 4
  • 19
  • 47
  • According to Firebase [release notes](https://firebase.google.com/support/release-notes/ios#authentication_5) this issue has been fixed. – deniz Jul 15 '21 at 04:15

0 Answers0