-
Notifications
You must be signed in to change notification settings - Fork 518
Question: What are others approach for SPA and MVC to trigger authentication? #1552
Comments
@NelsonLamprecht depends on how you trying to implement authentication. from angular side then don't go over hosting spa on cshtml else you need to go over mvc but hosting spa on cshtml which is not much recommend. Currently I'm facing few troubles by hosting spa on cshtml in prod.
In new aspnet angular 5 cli template it is not smooth as before template. you need to find way to work it.
you can dot it. but need to check all your concerns like storing and passing token to angular side. |
I have this same issue... was there a recommended approach found here? |
I cover my method here: Basically I log in a person with code like this:
|
Many people use IdentityServer as a OIDC/OAuth2 token service to protect their APIs. The SPA code can then use something like oidc-client to obtain and manage tokens. http://identityserver.io/ samples here: http://docs.identityserver.io/en/release/quickstarts/7_javascript_client.html |
Hope some of the approaches described here are what you need. I'll mark this closed since it's not an active work item, but please feel free to continue the discussion! |
@brockallen - your suggestion of using the oidc-client is perfect, thank you. That pointed me in the right direction. Since my application is an Angular 5 application, I was able to follow this article and am now successfully authenticating against my identity provider. |
Is it using the MapSpaFallbackRoute and hosting the SPA on that mvc cshtml page instead of the angular cli index.html?
Is it calling an authenticated mvc api and forcing a redirect in SPA?
Other solutions with the angular cli config?
What I don't want is any unauthenticated access to the application....
The text was updated successfully, but these errors were encountered: