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

[Question]: Is it possible to implement multiple configurations for Angular 17 standalone components project? #1902

Open
soniafaria opened this issue Feb 21, 2024 · 3 comments
Labels

Comments

@soniafaria
Copy link

soniafaria commented Feb 21, 2024

What Version of the library are you using?
17.0.0

Question
How can I implement multiple authentication configurations and router guards for an Angular 17 project, using standalone components?

@timdeschryver
Copy link
Contributor

Hi, the capabilities of the "standalone" VS "module" should be the same.
The only difference is "how" this is configured within an app.

In other words, a standalone project can still use multiple configurations.
As an example you can take a look at https://github.com/damienbod/angular-auth-oidc-client/blob/main/projects/sample-code-flow-standalone/src/app/app.config.ts (which is configured for a single config, but you can also provide an array of configs just as with the module approach).

@soniafaria
Copy link
Author

Thanks for your response @timdeschryver! I have successfully implemented multiple configurations, but one thing that I am not achieving is the protection of routes via custom guard, when using multiple configurations. I saw this example in the documentation but isAuthentication is always false. I understood by the documentation that this value returns false when having multiple configurations, is there any other way I can implement it? Thanks 😀

@timdeschryver
Copy link
Contributor

@soniafaria I don't have "real" experience with it.
But AFAIK if you use isAuthenticated instead of isAuthenticated$ you can provide a configId.
If you provide the configuration id, isAuthenticated will return the result for that configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants