Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "ribbo"

Same issue with Angular in the Public site project. Some of the files look to be under "browser_components" but not all.

Hi, I have just merged the latest 4.1 code into my project. It all runs correctly and displays the swagger API in the web browser when the project is run. But when I try execute the nswag refresh.bat I am getting the below error " Sequence contains more than one matching element". Any idea why this might be happening?

System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Sequence contains more than one matching element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate) at NSwag.CodeGeneration.TypeScript.Templates.RequestBodyTemplate.TransformText() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\RequestBodyTemplate.tt:line 2 at NSwag.CodeGeneration.TypeScript.Templates.AngularClientTemplate.TransformText() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\AngularClientTemplate.tt:line 50 at NSwag.CodeGeneration.TypeScript.Templates.AngularClientTemplate.Render() in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration.TypeScript\Templates\AngularClientTemplate.Extensions.cs:line 18 at NSwag.CodeGeneration.ClientGeneratorBase`3.GenerateFile(SwaggerDocument document, ClientGeneratorOutputType type) in C:\Data\Projects\NSwag\src\NSwag.CodeGeneration\ClientGeneratorBase.cs:line 90 at NSwag.Commands.SwaggerToTypeScriptClientCommand.<

Thanks, Matt

Hi, When trying to run a unit test directly on the domain layer {Project}.Core manager class, if the class tries to access a repository I get an error "Message: System.ObjectDisposedException : Cannot access a disposed object. "

If I instead add a call to the same manager function from the Application Layer {Project}.Application and call the application layer from the unit test it all works. Ie. If the manager has been created via the Application layer instead of within the Unit test all is fine.

Is there a way I should setup my test differently if directly call with .Core manager classes? Think it might be to do with the Unit Of Work disposing of it somehow?

All sample tests I can find samples of are doing it to the {Project}.Application layer.

Thanks, Matt

Great news, will keep an eye out on the repository.

MVC Core + JQuery solution works perfect.

Core + Angular 4 works but fails to get externallogindetails on call back (this is by calling MVC controller directly in browser not interacting with Angular at all). Assumed Cookie issue.

I have just added a new controller to Web.Host called "AuthenticationController", which is basically the same as the AccountController from the MVC Project.

So that raises a big question and where maybe my issue is. This controller is sitting within Web.Host, I have not added a whole new project called Web.Mvc. Is there differences in Web.Host VS Web.Mvc that would stop this from working?

So my StartUp/AuthConfigure.cs has this code in Web.Host app.UseGoogleAuthentication And the controller added to Web.Host. The controller\login works perfectly until ExternalLoginCallback is called with _signInManager.GetExternalLoginInfoAsync just gets NULL. I am now wondering if this is because it is all sitting within the Web.Host project and not a new Web.Mvc project from the MVC solution.

Is there a way to get Web.Host to work for this as I don't really want to have a separate project that needs to be run (1 for API and separate 1 for MVC).

Thanks, Matt

Also when is your next release out? As it sounds like it will have exactly what I am looking for in it.

Thanks, Matt

Thanks for the info. Your option here is exactly what I am trying to do "If you can login use with the MVC side and register the new user, then you may try to pass a temporary token to the angular side. Angular then requests to server with the token, authenticates and gets an actual token."

The problem I am having is that the function call signInManager.GetExternalLoginInfoAsync() is returning NULL. This is not using the Angular side at all, just MVC domain\url directly. So all communication is within the same domain, but for some reason it some back NULL. This is for Google login as well for testing. Everything works correctly within the actual MVC package when I download it. So wondering if there is any setting I need to change for the Angular downloaded package?

Thanks, Matt

Hi Hikalkan, Would love some further guidance on this.

Thanks, Matt

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

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.

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

Showing 21 to 30 of 37 entries