Skip to content

[Question]: How can I extract the generated nonce? #2230

Description

@SitraLuka

What Version of the library are you using?
21.0.3

Question
In order to log in with Firebase Auth, I would like to have access to the generated nonce after OIDC login was successfull.
Perhaps something like this:

this.oidcSecurityService
      .checkAuth()
      .subscribe(async ({ accessToken, idToken, nonce }) => {
        const credential = provider.credential({
          accessToken,
          idToken,
          rawNonce: nonce,
        });
        await signInWithCredential(this.firebaseAuth, credential);
      });

As per the documentation of "@angular/fire/auth" OAuthProvider.credential:

The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of the raw nonce must match the nonce field in the ID token.

Looking at the source code, this doesn't look possible currently. I also don't see whether the generated nonce is actually SHA-256 hashed at all.

Help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions