Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Firebase Microsoft Login Fails with auth/internal-error on New Application #1095

Open
SathishkumarG3 opened this issue Aug 27, 2024 · 0 comments

Comments

@SathishkumarG3
Copy link

SathishkumarG3 commented Aug 27, 2024

Issue Description:
When attempting to log in to the new application using Microsoft login, an error occurs: firebase.service.ts:22 Error during Microsoft login: FirebaseError: Firebase: Error (auth/internal-error). The same Firebase configuration works fine with another application. However, when using a new Firebase configuration, the login process works as expected.


[REQUIRED] Environment Details:

  • Operating System version: [Windows 11]
  • Browser version: [128.0.6613.84]

[REQUIRED] Steps to Reproduce:

  1. Use the existing Firebase configuration.

  2. Attempt to log in to the new application using Microsoft login.

  3. Observe the error in the console:

    firebase.service.ts:22 Error during Microsoft login: FirebaseError: Firebase: Error (auth/internal-error).
    

Relevant Code:

import { Injectable, inject } from '@angular/core';
import { Auth, OAuthProvider, signInWithPopup, signOut } from '@angular/fire/auth';

@Injectable({
  providedIn: 'root'
})
export class FirebaseService {
  private afAuth: Auth = inject(Auth);

  constructor() { }

  // Login with Microsoft provider
  async loginWithMicrosoft() {
    try {
      const provider = new OAuthProvider('microsoft.com');
      provider.setCustomParameters({
        tenant: 'xxxxx',
      });
      const result = await signInWithPopup(this.afAuth, provider);
      return result;
    } catch (error) {
      console.error('Error during Microsoft login:', error);  // Log error for debugging
      throw error;
    }
  }

  // Logout the current user
  async logout(): Promise<void> {
    try {
      await signOut(this.afAuth);
    } catch (error) {
      console.error('Error during logout:', error);  // Log error for debugging
      throw error;
    }
  }
}

Additional Notes:

  • The same Firebase configuration works without issues in another application.
  • The error only occurs when using the existing configuration with the new application.
  • The tenantId was validated and confirmed to be correct.
  • The application is an Angular application and was run locally.
  • Switching to a new Firebase configuration resolves the login issue.

Request for Investigation: We need to understand why the existing Firebase configuration causes this error in the new application, despite working fine elsewhere. Additionally, a solution or workaround to use the existing configuration without errors would be ideal.


@github-staff github-staff deleted a comment from yiweifengyan Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@SathishkumarG3 and others