Base solution for your next web application

Activities of "ribbo"

Hi, I am trying to get the base downloaded Project working and followed the start up steps. I have not changed anything.

When I try login via <a class="postlink" href="http://localhost:4200/">http://localhost:4200/</a> with correct username\password it just redirects me back to the login page, not the dashboard. The initial password reset worked and if I type the wrong password it tells me failed login. So the ASP.NET Core API is working. Seems like the session token isn't working properly?

Not sure if this is relevant, but when I start the ASP.NET Solution for the first time Swagger is throwing a javascript error Unhandled exception at line 69, column 21 in <a class="postlink" href="http://localhost:22742/">http://localhost:22742/</a> 0x800a1391 - JavaScript runtime error: 'abp' is undefined

Line is var csrfToken = abp.security.antiForgery.getToken()

Thanks, Matt

Hi, Ok interesting, it works in Chrome but doesn't in IE11. How do I check the version? I only downloaded the new project yesterday.

Thanks, Matt

Hi, Checking if there is an issue with IE11? How do I check the version per your request? Note this is Angular 2.

Thanks, Matt

Hi, I am trying to add an OWIN integration login using Angular 2 and .NET Core. From what I can see .NET Core version isn't compatible to add OWIN integration yet? If not, is this planned or are there instructions on how to add it?

Thanks, Matt

Hi, What I am trying to do is an external login via Strava (<a class="postlink" href="https://strava.github.io/api/v3/oauth/">https://strava.github.io/api/v3/oauth/</a>), similar to Facebook\Google login. It uses OAuth 2. This is using Angular 2 ASP.NET Zero. I previously had this working on the base aspnetboilerplate framework AngularJS as it used MVC for its core login system. I added an OWIN Middleware that slotted in very nicely and everything worked. But because there aren't all the MVC related Server Side URL's the same concept doesn't seem to work.

I am having a lot more trouble getting my heard around the Angular 2 version with ASP.NET Zero as it is completely different using client side JS far more from what I can see. To do Facebook\Google it seems to be using complex helper SDK JS libraries from each login provider. Are you able to point me in the right direction to add a 3rd party External Login via OAuth 2?

Thanks, Matt

Hi, Using Angular 2 what do you recommend is the best way to implement an OAuth 2 external login? The site is Strava, <a class="postlink" href="https://strava.github.io/api/v3/oauth/">https://strava.github.io/api/v3/oauth/</a>

My problem is your implementation of Facebook and Google login uses their JS library to do get the accessToken, however this site doesn't provide any kind of pre-built JS SDK like that.

I did have this working previously on aspnetboiler plate with AngularJS by using OWIN (there is a pre-build OWIN middleware for the above Strava site), but this used MVC based Account login. But I don't know how I would add the same methods with the new Angular 2 architecture or if that is the best way to try go.

Thanks, Matt

Hi, I have found a Strava OAuth provider via <a class="postlink" href="https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers">https://github.com/aspnet-contrib/AspNe ... .Providers</a>

This is working perfectly when add to the aspnet zero MVC Core project. I have tried to migrate over the AccountController to the Angular 2 project, this way I can use MVC just to provide the 3rd party login\registration.

Everything seems to work correctly, I can see AspNet.Security.OAuth.Strava getting all the user details in the CreateTicketAsync function. The function ExternalLoginCallback gets called but the problem is within this function the externalLoginInfo is always null.

var externalLoginInfo = await _signInManager.GetExternalLoginInfoAsync(); always returns null.

I think this might be an issue with Cookie External Authentication, is there something I am missing to get this to work in the Core/Angular project?

Thanks, Matt

Hi, This won't work as it requires all the OAuth logic to be implemented via the Angular UI? There is no Javascript SDK for Strava OAuth like there is for Facebook\Google.

The reason I have decided to implement the MVC controller\authentication from the aspnet zero MVC project is because there is one written for .NET MVC based AspNet.Security.OAuth which is AspNet.Security.OAuth.Strava. This works PERFECTLY under your MVC project. So its easier to just add the MVC controller to the Angular project just for the sign in (similar to how you had the original Angular JS working).

I also tried to add the Google authentication via MVC to ensure it isn't my Strava OAuth. I did this with AuthConfigurer.cs by adding. app.UseGoogleAuthentication(new GoogleOptions { ClientId = "{myClientId}", ClientSecret = "{mySecret}" }); This had the exact same result, everything worked except the external login info returns null. var externalLoginInfo = await _signInManager.GetExternalLoginInfoAsync(); always returns null.

So what I need to know, what do I need to add to the Core\Angular project to get the MVC External Login to work? From what I can tell all the StartUp.cs is nearly the same between Angular and MVC projects.

Thanks, Matt

To clear 1 thing up... when I talk about your MVC Project, I mean the "ASP.NET CORE MVC & Jquery". I have essentially copied over the AccountController to manage the external OAuth login.

That makes sense as all my research pointed to Cookie Authentication not being setup correctly in StartUp used to get the External Login detail. While I understand the reason in terms of having login via Angular needing Token Authentication. Is there a way to enable Cookie Authentication for the MVC side so this flow works and also have Token Authentication at the same time in the same solution? There isn't any JS library I can find provided by Strava which means implementing my self (which I would prefer not to do same reason as you have for Microsoft).

The flow I was thinking (confirm if this will or won't work), if I can turn on Cookie Authentication for MVC in the same project along side :

  1. User hits Angular Client where there is a "Sign in to Strava" button eg. <a class="postlink" href="http://www.mysite.com">www.mysite.com</a>
  2. Button takes them to login.mysite.com/login/strava. This will be a separate subdomain where the API\MVC is.
  3. MVC takes over OAuth login and returns them to login.mysite.com/login/ExternalLoginCallback
  4. ExternalLoginCallback gets details via Cookie Authentication with signInManager.GetExternalLoginInfoAsync(); and registers the user if it doesn't exist
  5. If user exists login via Token authentication and return them back to <a class="postlink" href="http://www.mysite.com">www.mysite.com</a> Angular site logged in with the Token

The flows seems to be almost the same as the old .NET\Angular JS (before Angular 2 project) where MVC was used for authentication and Angular for the rest. Currently I have everything above working up to step (4) where it fails to get the LoginInfo due to the cookie authentication. If you can tell me how to turn on Cookie Authentication I think everything will work for me.

Thanks, Matt

Showing 1 to 10 of 37 entries