Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

269
Vistas
Firebase does not show up sign page for microsoft.com in Swift / iOS

I am implementing the Firebase authentication by using OAuthProvider class to sign in with a personal microsoft account.

I have followed this instructions: https://firebase.google.com/docs/auth/ios/microsoft-oauth?authuser=0

However when I am using OAuthProvider of Firebase SDK it does not show up the sign in page of Microsoft, actually nothing gets invoked by getCredentialWith.

When I am using GoogleAuthProvider everything works fine and Firebase SDK shows up the sign in page of Google.

let provider = OAuthProvider(providerID: "microsoft.com")
provider.scopes = ["files.readwrite.appfolder", "user.read"]

provider.getCredentialWith(nil, completion: { credential, error in
  if let error = error {
    os_log("Firebase Error: %@", type: .fault, error as CVarArg)
    return
  }

  if (credential != nil) {
    Auth.auth().signInAndRetrieveData(with: credential!, completion: { authResult, error in
      if let error = error {
        os_log("Firebase Error: %@", type: .fault, error as CVarArg)
        return
      }
    })
  }
})
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Declare in global scope like below

var provider: OAuthProvider?
var authMicrosoft: Auth?


@IBAction func buttonTapped(_ sender: Any) {


     provider = OAuthProvider(providerID: "microsoft.com")


    provider?.customParameters = [
        "prompt": "consent",
                "login_hint": "",
    ]

    provider?.scopes = ["mail.read", "calendars.read"]




    provider?.getCredentialWith(nil ) { credential, error in
        if error != nil {
            // Handle error.
        }

        print(credential?.provider)



        if let x = credential {
            self. authMicrosoft?.signIn(with: x) { authResult, error in
                if error != nil {
                    // Handle error.
                }


                print(authResult?.additionalUserInfo?.profile)
                print(authResult?.user.providerID)


            }
        } else {

        }

    }

}
over 4 years ago · Santiago Trujillo Denunciar

0

It seems that you define a provider locally. While the getCredentialWith(_:completion) call gets executed asynchronously, your local function may already finished executing, and the provider may already be deallocated by ARC.

To solve your problem, you may need to specifically retain the provider pointer somewhere --- for instance in your view controller as a property or ivar, and by that way the provider can be created/recycled when your view controller is initialized/deallocated.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda