8000 angular-standalone-sample does not work properly · Issue #7757 · AzureAD/microsoft-authentication-library-for-js · GitHub
[go: up one dir, main page]

Skip to content

angular-standalone-sample does not work properly #7757

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

Closed
bviala opened this issue May 19, 2025 · 3 comments
Closed

angular-standalone-sample does not work properly #7757

bviala opened this issue May 19, 2025 · 3 comments
Labels
documentation Related to documentation. msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@bviala
Copy link
bviala commented May 19, 2025

Core Library

MSAL.js (@azure/msal-browser)

Wrapper Library

MSAL Angular (@azure/msal-angular)

Public or Confidential Client?

Public

Documentation Location

https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular-standalone-sample

Description

First off, if you're still using AD B2C, the sample code just doesn't work at all, you'll get an error:

ERROR ClientAuthError: endpoints_resolution_error: Endpoints cannot be resolved

You need to add knownAuthorities: ['https://XXXX.b2clogin.com'] to the auth configuration.

After you do so, the authentication flow works fine, but when you refresh the page the toolbar (app.component ) doesn't keep the logged in state and displays the "login" button again, instead of "logout". For some reason the inProgress$ observable isn't triggered.

Curiously enough the same code works in the home.component, I can't figure out why.

Also can't figure out why the home.component has a whole bunch of direct interactions with the msal library just to get the auth state when it should really just consume an auth.service

@bviala bviala added question Customer is asking for a clarification, use case or information. documentation Related to documentation. labels May 19, 2025
@github-actions github-actions bot added msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels May 19, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label May 19, 2025
@pavanshinde47
Copy link

Hi, can you tell me how did you get to that. I am not able to run it at all. Can you please provide the steps?

@bviala
Copy link
Author
bviala commented May 21, 2025

What's your problem exactly? Download the sample code, replace the values in src/environments/environment.dev.ts with the values from your AD B2C setup, run the app.

The knownAuthorities property should be added line 49 in src/app/app.config.ts

@tnorling
Copy link
Collaborator

The sample you're trying to use was not designed for B2C. We have a B2C specific sample here. Hope that helps!

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Attention 👋 Awaiting response from the MSAL.js team label May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to documentation. msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

3 participants
0