You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Question: What are others approach for SPA and MVC to trigger authentication? #1552
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....
changed the title [-]Question: What is the best approach for SPA and MVC to trigger authentication?[/-][+]Question: What others approach for SPA and MVC to trigger authentication?[/+]on Feb 23, 2018
changed the title [-]Question: What others approach for SPA and MVC to trigger authentication?[/-][+]Question: What are others approach for SPA and MVC to trigger authentication?[/+]on Feb 23, 2018
@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.
MapSpaFallbackRoute and hosting the SPA on that mvc cshtml page instead of the angular cli index.html?
In new aspnet angular 5 cli template it is not smooth as before template. you need to find way to work it.
Is it calling an authenticated mvc api and forcing a redirect in SPA?
you can dot it. but need to check all your concerns like storing and passing token to angular side.
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.
@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.
Activity
[-]Question: What is the best approach for SPA and MVC to trigger authentication?[/-][+]Question: What others approach for SPA and MVC to trigger authentication?[/+][-]Question: What others approach for SPA and MVC to trigger authentication?[/-][+]Question: What are others approach for SPA and MVC to trigger authentication?[/+]k11k2 commentedon Feb 26, 2018
@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.
akiander commentedon Mar 21, 2018
I have this same issue... was there a recommended approach found here?
ADefWebserver commentedon Mar 21, 2018
I cover my method here:
http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/4312/An-Angular-4-DotNetCore-2-0-Example-With-Application-Shell-and-Authentication.aspx
Basically I log in a person with code like this:
brockallen commentedon Mar 21, 2018
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/
https://www.npmjs.com/package/oidc-client
samples here: http://docs.identityserver.io/en/release/quickstarts/7_javascript_client.html
SteveSandersonMS commentedon Mar 23, 2018
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!
akiander commentedon Mar 23, 2018
@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.