Getting error while using login with microsoft using firebase in my flutter app.

Parth Bhanderi 5 Reputation points
2023-07-14T06:24:49.8+00:00

I'm using firebase_auth package to integrate login with Microsoft in my Flutter app. I have followed all the official documentation.
https://firebase.google.com/docs/auth/flutter/federated-auth#ios+_1
But, I'm getting the below error.

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: [firebase_auth/invalid-credential] Error getting access token from microsoft.com, OAuth2 redirect uri is: https://mind-bank-ai.firebaseapp.com/__/auth/handler, response: OAuth2TokenResponse{params: error=invalid_request&error_description=AADSTS90023:%20Public%20clients%20can't%20send%20a%20client%20secret.%0D%0ATrace%20ID:%20ab452da6-2324-4674-84f8-272eb6c69b00%0D%0ACorrelation%20ID:%207cc2e2a8-0cd1-4ae5-948c-299ce3cd3271%0D%0ATimestamp:%202023-07-14%2005:29:12Z&timestamp=2023-07-14%2005:29:12Z&trace_id=ab452da6-2324-4674-84f8-272eb6c69b00&correlation_id=7cc2e2a8-0cd1-4ae5-948c-299ce3cd3271, httpMetadata: HttpMetadata{status=400, cachePolicy=NO_CACHE, cacheDurationJava=null, cacheImmutable=false, staleWhileRevalidate=null, filename=null, lastModified=null, retryAfter=null, crossOriginEmbedderPolicy=null, crossOriginOpenerPolicy=null, crossOriginResourcePolicy=null, headers=HTTP/1.1 200 OK

Thanks in advance.

Microsoft Security Microsoft Entra Microsoft Entra ID
{count} vote

2 answers

Sort by: Most helpful
  1. James Hamil 27,211 Reputation points Microsoft Employee Moderator
    2023-07-14T20:11:49.2033333+00:00

    Hi @Parth Bhanderi , it seems like you're encountering an error related to the OAuth2 token response from Microsoft. The error message indicates that public clients can't send a client secret [VERBOSE-2:dart_vm_initializer.cc(41)].

    To resolve this issue, you should ensure that you're not sending a client secret when making the OAuth2 request. Double-check your configuration and make sure that you're not including a client secret in the request. If you're using the firebase_auth package, ensure that you've followed the official documentation correctly and haven't accidentally included a client secret in your configuration.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James


  2. James Finlinson 0 Reputation points
    2025-04-11T17:31:55.3066667+00:00

    Several people have discussed this problem and proposed solution on Stack Overflow:

    (That site actually solves problems instead of asking for subscription IDs.)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.