Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

274
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda