Open Closed

Receiving UriException when logging in from MAUI iOS app #6812


User avatar
0
darutter created
  • ABP Framework version: v8.0.4
  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue: I created a solution with abp commercial and deployed the app to Azure. The web app executes properly but when I attempt to use the iOS app to log into the app I get the error (Uri scheme is invalid). However this is what I see in the log of the web app: 2024-03-06 14:44:21.153 +00:00 [INF] Request starting HTTP/1.1 GET https://mysite.azurewebsites.net/.well-known/openid-configuration - null null 2024-03-06 14:44:21.154 +00:00 [INF] The request URI matched a server endpoint: "Configuration". 2024-03-06 14:44:21.154 +00:00 [INF] The configuration request was successfully extracted: {}. 2024-03-06 14:44:21.154 +00:00 [INF] The configuration request was successfully validated. 2024-03-06 14:44:21.179 +00:00 [INF] The response was successfully returned as a JSON document: { "issuer": "https://mysite.azurewebsites.net/", "authorization_endpoint": "https://mysite.azurewebsites.net/connect/authorize", "token_endpoint": "https://mysite.azurewebsites.net/connect/token", "introspection_endpoint": "https://mysite.azurewebsites.net/connect/introspect", "end_session_endpoint": "https://mysite.azurewebsites.net/connect/logout", "revocation_endpoint": "https://mysite.azurewebsites.net/connect/revocat", "userinfo_endpoint": "https://mysite.azurewebsites.net/connect/userinfo", "device_authorization_endpoint": "https://mysite.azurewebsites.net/device", "jwks_uri": "https://mysite.azurewebsites.net/.well-known/jwks", "grant_types_supported": [ "authorization_code", "implicit", "password", "client_credentials", "refresh_token", "urn:ietf:params:oauth:grant-type:device_code", "LinkLogin", "Impersonation" ], "response_types_supported": [ "code", "code id_token", "code id_token token", "code token", "id_token", "id_token token", "token", "none" ], "response_modes_supported": [ "form_post", "fragment", "query" ], "scopes_supported": [ "openid", "offline_access", "email", "profile", "phone", "roles", "address", "Simul_BCFO" ], "claims_supported": [ "aud", "exp", "iat", "iss", "sub" ], "id_token_signing_alg_values_supported": [ "RS256" ], "code_challenge_methods_supported": [ "plain", "S256" ], "subject_types_supported": [ "public" ], "token_endpoint_auth_methods_supported": [ "client_secret_post", "private_key_jwt", "client_secret_basic" ], "introspection_endpoint_auth_methods_supported": [ "client_secret_post", "private_key_jwt", "client_secret_basic" ], "revocation_endpoint_auth_methods_supported": [ "client_secret_post", "private_key_jwt", "client_secret_basic" ], "device_authorization_endpoint_auth_methods_supported": [ "client_secret_post", "private_key_jwt", "client_secret_basic" ], "claims_parameter_supported": false, "request_parameter_supported": false, "request_uri_parameter_supported": false, "authorization_response_iss_parameter_supported": true }. 2024-03-06 14:44:21.180 +00:00 [INF] Request finished HTTP/1.1 GET https://mysite.azurewebsites.net/.well-known/openid-configuration - 200 2393 application/json;charset=UTF-8 26.5092ms 2024-03-06 14:44:21.295 +00:00 [INF] Request starting HTTP/1.1 GET https://mysite.azurewebsites.net/.well-known/jwks - null null 2024-03-06 14:44:21.295 +00:00 [INF] The request URI matched a server endpoint: "Cryptography". 2024-03-06 14:44:21.297 +00:00 [INF] The cryptography request was successfully extracted: {}. 2024-03-06 14:44:21.297 +00:00 [INF] The cryptography request was successfully validated. 2024-03-06 14:44:21.298 +00:00 [INF] The response was successfully returned as a JSON document: { "keys": [ { "kid": "DB61AF87D83CE6A8D9A70E2B294A883FCA775318", "use": "sig", "kty": "RSA", "alg": "RS256", "e": "AQAB", "n": "skALvj47tjODn8738V2JzbgePwEB8noSh_edgMe5MKmdF6vyD22GBb4OV4Tf9uZJdc6EFukGv9qH_lzUiZn8W2TFnE4BuJ3NDEl4BenJnGTZwsW7Z80n-NVR3hGBhWht4bWURdIT2zWvWjhn89GPNRQsd7838jLrkjR_J53Y534QgYLe5Rq5E-n7TVhLcgyS75pMOiJ-JDqViyG3We1yew9ClfkZImkS8nqIjANcZtvAQHud82euDwedS_iiKH0cr0L6LyZeVCW6gyAJ68vkgfTLJsn7riQvM7A5_7q7oY7x4NAjibtEckBIvcdBSy7pvaDcS8CqjZmBMpQuX5SnVQ", "x5t": "22Gvh9g85qjZpw4rKUqIP8p3Uxg", "x5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finished HTTP/1.1 GET https://mysite.azurewebsites.net/.well-known/jwks - 200 1667 application/json;charset=UTF-8 4.0176ms

When I copy the Url from the call in the MauiAuthenticationBrowser.cs file into the browser, I get a 400 error. Can you provide any insight to what is happening and how to fix it?


4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I didn't see any error message.

    Can you share the full error logs? thanks.

  • User Avatar
    0
    darutter created

    There is no error in the log file. The error happens when the result is sent back. It is a System.UriException: the Uri scheme is invalid. The rest of the message merely points to the call to this call: var webAuthenticatorOptions = new WebAuthenticatorOptions { Url = new Uri(options.StartUrl), CallbackUrl = new Uri(options.EndUrl), PrefersEphemeralWebBrowserSession = true };

    As I mentioned, If i copy the URL from the call into a browser I get a 400 error with no real information.

  • User Avatar
    0
    darutter created

    I have a second MAUI app that was created with abp.io commercial 8.0.4 and it does the exact same thing when I attempt to login with the iOS app. There is no error in the log file, and it actually indicates that the call succeeds and returns a 200 status, but if fails in both the app and pasting the URL into a browser.

    Both of these apps are fresh builds without any modifications to the MAUI project other than pointing them to the Azure web app service that hosts the web / api portion of the solution.

  • User Avatar
    0
    darutter created

    I found the problem. I had the wrong values in both RedirectUri and the PostLoginRedirectUri. Once I changed those it worked.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11