From a3dea4659f9e0210d723f4297b7a0af99295c70a Mon Sep 17 00:00:00 2001 From: Panagiotis Giannoutsos <36935711+Panosfunk@users.noreply.github.com> Date: Mon, 24 Nov 2025 14:45:46 +0100 Subject: [PATCH] construct correct uri --- .../carp_webservices/lib/carp_auth/carp_auth_service.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backends/carp_webservices/lib/carp_auth/carp_auth_service.dart b/backends/carp_webservices/lib/carp_auth/carp_auth_service.dart index 68949620..ea71d3dc 100644 --- a/backends/carp_webservices/lib/carp_auth/carp_auth_service.dart +++ b/backends/carp_webservices/lib/carp_auth/carp_auth_service.dart @@ -172,6 +172,7 @@ class CarpAuthService { String? code; String? clientId = _authProperties?.clientId; String? redirectUri = _authProperties?.anonymousRedirectURI?.toString(); + uri = _constructAuthUri(uri); TokenResponse tokenResponse = await FlutterWebAuth2.authenticate( url: uri, @@ -182,6 +183,7 @@ class CarpAuthService { ), ).then((result) async { code = Uri.parse(result).queryParameters['code']; + if ((_currentUser == null || _currentUser!.isAuthenticated) && code != null) { return await FlutterAppAuth().token( @@ -237,6 +239,11 @@ class CarpAuthService { ); } + String _constructAuthUri(String uri) { + String secondPart = uri.split('action-token').last; + return '${authProperties.discoveryURL}/login-actions/action-token$secondPart'; + } + /// Authenticate to this CARP service using a [username] and [password]. /// /// The discovery URL in the [authProperties] is used to find the Identity Server.