When the api-solution starts up, PostInitialize() in WebHostModule calls ConfigureExternalAuthProviders() and adds the ExternalLoginProviders to the list. But GetExternalAuthenticationProviders() in TokenAuthController does'nt get called before the Angular solution loads the login page. And then it don't hit the code in the WebHostModule.
The interface IExternalAuthConfiguration is injected into TokenAuthController, but I can't find out how the code that resolves the mapping to this interface is :(
<cite>aaron: </cite> Then you need this commit too: b0b7919
My solution already have this code. And when I debug, I can see this code in WebHostModule work. When it starts up it adds the authentication providers to the list in ConfigureExternalAuthProviders() method. But when the method GetExternalAuthenticationProviders() in the TokenAuthController class is calling this code, it returns 0; I don't get any exceptions.
Where is the code that is going to fill _externalAuthConfiguration.Providers in this method?
[HttpGet] public List<ExternalLoginProviderInfoModel> GetExternalAuthenticationProviders() { return ObjectMapper.Map<List<ExternalLoginProviderInfoModel>>(_externalAuthConfiguration.Providers); }
<cite>aaron: </cite> You can refer to this commit: 0c71eef
Thanks, but my problem is in the api side. If you read my first post I have described my problem. If I debug I don't get the same result as Alper. His solution returns a list of ExternalLoginProviders from TokenAuthController. But my solution returns zero even if I have configured my provider settings in appsettings.json.
Was this a major bugfix or can I get the code and paste it into my solution? It is importent for me to solve this issue.
<cite>aaron: </cite> Which version of ASP.NET Zero are you on? That was fixed in v5.1.0.
It says v5.0.0.0 but I just upgraded all my nuget packages , and the version did'nt change.
<cite>aaron: </cite> Did you select a tenant on the Login page?
I have disabled MultiTenancy, so this is not an option.
<cite>alper: </cite> You need to be tenant to see social logins. Don't use HOST
I don't understand what you mean. What do you mean you need to be a tenant? When I run in debugger attached mode, _externalAuthConfiguration.Providers returns 0;
No, I have not forgotten it.
ConfigureExternalAuthProviders() in GlobalOpinionsWebHostModule class is adding my providers to the list when the solution starts up.
It must be something else.
Where is the code that fills providers in _externalAuthConfiguration.Providers?
<cite>ismcagdas: </cite> Hi @affern,
If you use app service approach, then you can remove the auth token on angular client and then reload the page using regular javascript.
You can check logout method of angular app to remove token.
Thanks, @ismcagdas! I called the logout method in AppAuthService after the DeleteMe method. It works fine.
<cite>alirizaadiyahsi: </cite> Hi @affern, why don't use AccountAppService instead of AccountController? What is your project type? Angular or mvc?
My project type is Angular. Maybe I can use AccountAppService. But I don't think it works to redirect to login in Angular after I have deleted the user. I tried to put the DeleteMe method in my own service and do the redirect in Angular after, but I did'nt get it to work. The AccountAppService can't return RedirectToAction result, so how do you solve this?