If you're creating a bug/problem report, please include followings:
[0:] An error occurred: 'Error loading discovery document: Issuer name does not match authority: https://localhost:44343/'. Callstack: ' at IdentityModel.OidcClient.OidcClient.EnsureProviderInformationAsync(CancellationToken cancellationToken) in //src/OidcClient/OidcClient.cs:line 410 at IdentityModel.OidcClient.OidcClient.EnsureConfigurationAsync(CancellationToken cancellationToken) in //src/OidcClient/OidcClient.cs:line 371 at IdentityModel.OidcClient.OidcClient.LoginAsync(LoginRequest request, CancellationToken cancellationToken) in /_/src/OidcClient/OidcClient.cs:line 73 at Amazing.Software.Mobile.Maui.Oidc.LoginService.LoginAsync() in C:\LearnABP\Amazing.Software.Mobile\aspnet-core\src\Amazing.Software.Mobile.Maui\Oidc\LoginService.cs:line 21 at Amazing.Software.Mobile.Maui.ViewModels.MainPageViewModel.LoginOrLogoutAsync() in C:\LearnABP\Amazing.Software.Mobile\aspnet-core\src\Amazing.Software.Mobile.Maui\ViewModels\MainPageViewModel.cs:line 53 at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state) at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) at Amazing.Software.Mobile.Maui.Program.Main(String[] args) in C:\LearnABP\Amazing.Software.Mobile\aspnet-core\src\Amazing.Software.Mobile.Maui\Platforms\iOS\Program.cs:line 12 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)' The app has been terminated.
appsettings.json of web project
{
"App": {
"SelfUrl": "https://localhost:44343/"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=AmazingSoftwareMobile;Trusted_Connection=True"
},
"AuthServer": {
"Authority": "https://localhost:44343/",
"RequireHttpsMetadata": "false",
"ValidIssuers": [ "https://10.10.30.30:45455/" ]
},
"StringEncryption": {
"DefaultPassPhrase": "MBvujhnLzlU9atyZ"
}
}
appsettings.json of maui project
{
"Oidc": {
"Options": {
"Authority": "https://10.10.30.30:45455/",
"ClientId": "Mobile_Maui",
"RedirectUri": "mobile://",
"PostLogoutRedirectUri": "mobile://",
"Scope": "offline_access Mobile"
}
},
"RemoteServices": {
"Default": {
"BaseUrl": "https://10.10.30.30:45455/"
}
}
}
ConfigureAuthentication Method in MobileWebModule
as you can see I have added the Valid Issuer as 10.10.30.30
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAuthentication().AddJwtBearer(options => {
options.TokenValidationParameters.ValidIssuers = configuration.GetSection("AuthServer:ValidIssuers").Get<string[]>();
});
context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme);
}
The local address of my pc is https://10.10.30.30, I can browse the website in my browser security with no errors and can also download the https://10.10.30.30:45455/.well-known/openid-configuration
I am using Conveyor by Keyoti
for tunneling because can't use the local host as suggested in Microsoft Docs to use the HostName or IP address of the computer the ports 44343 and 45455 are both open in the windows firewall
If you are using the Remote iOS simulator from your Mac even in the safari it will not work because the Remote iOS simulator looks at the Mac as localhost be the backend is running on windows
However if I run the backend on the Mac then it will work on windows Remote iOS Simulator
Yeah but I am using remote iOS simulator on my mac and the backend app is running on my windows so is the Maui project so to see it I have used pair to Mac and need the Mac to be able to browse to the back end so easiest way was to use ngrok and modify the handler
I have followed all the documentation and the application successfully runs but when I click on the login button i get the following error
I am even using ngrok so the backend is available on the web
System.InvalidOperationException Message=Error loading discovery document: Error connecting to https://<omited>.au.ngrok.io/.well-known/openid-configuration. An error occurred while sending the request..
When i go to that URL in browser I do get a response with off the openid-configuration
Message=Error loading discovery document: Error connecting to https://localhost:44330/.well-known/openid-configuration. Failed to connect to localhost/127.0.0.1:44330.
appsetting.json
in Maui project
{
"Oidc": {
"Options": {
"Authority": "https://localhost:44330",
"ClientId": "Mobile_Maui",
"RedirectUri": "mobile://",
"PostLogoutRedirectUri": "mobile://",
"Scope": "offline_access Mobile"
}
},
"RemoteServices": {
"Default": {
"BaseUrl": "https://localhost:44330"
}
}
}
appsettings.json in Web project
{
"App": {
"SelfUrl": "https://localhost:44381"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=AmazingSoftwareMobile;Trusted_Connection=True"
},
"AuthServer": {
"Authority": "https://localhost:44381",
"RequireHttpsMetadata": "false"
},
"StringEncryption": {
"DefaultPassPhrase": "<omitted>"
}
}
even if I change https://localhost:44330 to https://localhost:44381 it doesn't work
Why do i still get a warning [16:35:30 WRN] Couldn't determinate version of "@abp/ng.schematics" package.
?
looks like the generation is fine
These are the errors I am getting in the console
here is the log in debug mode
2022-05-02 10:42:51.038 +00:00 [DBG] Added bundle 'Lepton.Global' to the page in 8.59 ms.
2022-05-02 10:42:51.039 +00:00 [INF] Executed page /Index in 762.1019ms
2022-05-02 10:42:51.039 +00:00 [INF] Executed endpoint '/Index'
2022-05-02 10:42:51.040 +00:00 [INF] Request finished HTTP/1.1 GET http://staging.ppm.desertfireonline.com/ - - - 200 - text/html;+charset=utf-8 851.3424ms
2022-05-02 10:42:59.894 +00:00 [INF] Request starting HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/.well-known/openid-configuration - -
2022-05-02 10:42:59.916 +00:00 [INF] CORS policy execution successful.
2022-05-02 10:42:59.973 +00:00 [DBG] CORS request made for path: /.well-known/openid-configuration from origin: http://localhost:8100
2022-05-02 10:43:00.831 +00:00 [DBG] CorsPolicyService allowed origin: http://localhost:8100
2022-05-02 10:43:00.832 +00:00 [INF] CORS policy execution successful.
2022-05-02 10:43:00.850 +00:00 [DBG] Request path /.well-known/openid-configuration matched to endpoint type Discovery
2022-05-02 10:43:02.760 +00:00 [DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryEndpoint
2022-05-02 10:43:02.761 +00:00 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryEndpoint for /.well-known/openid-configuration
2022-05-02 10:43:02.769 +00:00 [DBG] Start discovery request
2022-05-02 10:43:04.085 +00:00 [INF] Request finished HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/.well-known/openid-configuration - - - 200 - application/json;+charset=UTF-8 4185.0806ms
2022-05-02 10:43:04.144 +00:00 [INF] Request starting HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/api/abp/application-configuration - -
2022-05-02 10:43:04.145 +00:00 [INF] CORS policy execution successful.
2022-05-02 10:43:04.233 +00:00 [DBG] CORS request made for path: /api/abp/application-configuration from origin: http://localhost:8100 but was ignored because path was not for an allowed IdentityServer CORS endpoint
2022-05-02 10:43:04.233 +00:00 [INF] No CORS policy found for the specified request.
2022-05-02 10:43:04.282 +00:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
2022-05-02 10:43:04.302 +00:00 [INF] Route matched with {area = "abp", action = "Get", controller = "AbpApplicationConfiguration", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto] GetAsync() on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController (Volo.Abp.AspNetCore.Mvc).
2022-05-02 10:43:04.398 +00:00 [DBG] Executing AbpApplicationConfigurationAppService.GetAsync()...
2022-05-02 10:43:06.477 +00:00 [DBG] Executed AbpApplicationConfigurationAppService.GetAsync().
2022-05-02 10:43:06.487 +00:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'.
2022-05-02 10:43:06.644 +00:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc) in 2341.717ms
2022-05-02 10:43:06.644 +00:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
2022-05-02 10:43:06.652 +00:00 [INF] Request finished HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/api/abp/application-configuration - - - 200 - application/json;+charset=utf-8 2507.7572ms
2022-05-02 10:44:00.151 +00:00 [INF] Request starting HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/ - -
2022-05-02 10:44:00.228 +00:00 [INF] Executing endpoint '/Index'
2022-05-02 10:44:00.228 +00:00 [INF] Route matched with {page = "/Index", action = "", controller = "", area = ""}. Executing page /Index
2022-05-02 10:44:00.228 +00:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy
2022-05-02 10:44:00.236 +00:00 [INF] Executing handler method Volo.Abp.Identity.Web.Pages.Identity.Users.PpmIndexModel.OnGetAsync - ModelState is "Valid"
2022-05-02 10:44:00.236 +00:00 [INF] Executed handler method OnGetAsync, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
Guys I am trying to run the angular project locally with a production ABP instance which is live and it gives me a cors error …. My cors setting in my appsetting.json includes Localhost … when in production does ABP not accept connections from Localhost ?
looking at the logs my production website says
2022-04-30 12:46:42.118 +00:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc) in 566.6566ms
2022-04-30 12:46:42.118 +00:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
2022-04-30 12:46:42.118 +00:00 [INF] Request finished HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/api/abp/application-configuration - - - 200 - application/json;+charset=utf-8 626.0485ms
2022-04-30 12:46:42.371 +00:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'.
2022-04-30 12:46:42.390 +00:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc) in 397.8441ms
2022-04-30 12:46:42.390 +00:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
2022-04-30 12:46:42.390 +00:00 [INF] Request finished HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/api/abp/application-configuration - - - 200 - application/json;+charset=utf-8 456.3726ms
2022-04-30 12:46:56.404 +00:00 [INF] Request starting HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/.well-known/openid-configuration - -
2022-04-30 12:46:56.404 +00:00 [INF] CORS policy execution successful.
2022-04-30 12:46:56.453 +00:00 [WRN] Origin is not allowed: http://localhost:8100
2022-04-30 12:46:56.453 +00:00 [WRN] CorsPolicyService did not allow origin: http://localhost:8100
2022-04-30 12:46:56.453 +00:00 [INF] No CORS policy found for the specified request.
2022-04-30 12:46:56.483 +00:00 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryEndpoint for /.well-known/openid-configuration
2022-04-30 12:46:56.501 +00:00 [INF] Request finished HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/.well-known/openid-configuration - - - 200 - application/json;+charset=UTF-8 97.3644ms
2022-04-30 12:46:56.523 +00:00 [INF] Request starting HTTP/1.1 GET http://dfo-dev-web.azurewebsites.net/api/abp/application-configuration - -
2022-04-30 12:46:56.524 +00:00 [INF] CORS policy execution successful.
2022-04-30 12:46:56.570 +00:00 [INF] No CORS policy found for the specified request.
2022-04-30 12:46:56.581 +00:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
2022-04-30 12:46:56.581 +00:00 [INF] Route matched with {area = "abp", action = "Get", controller = "AbpApplicationConfiguration", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto] GetAsync() on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController (Volo.Abp.AspNetCore.Mvc).
or appsettings.json is as follows
{ "App": { "SelfUrl": "https://dfo-dev-web.azurewebsites.net", "ClientUrl": "https://dfo-dev-word.azurewebsites.net", "CorsOrigins": "https://*.dfo-dev-web.azurewebsites.net,https://dfo-dev-word.azurewebsites.net,https://dfo-dev-web.azurewebsites.net,https://dfo-dev-public.azurewebsites.net,http://localhost:4200,http://localhost:8100", "RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307,http://localhost:8100" }, .....