diff --git a/packages/oidc4vc/lib/src/oidc4vc.dart b/packages/oidc4vc/lib/src/oidc4vc.dart index 4f55f8cf3..833469dd8 100644 --- a/packages/oidc4vc/lib/src/oidc4vc.dart +++ b/packages/oidc4vc/lib/src/oidc4vc.dart @@ -1710,8 +1710,12 @@ class OIDC4VC { var url = '$baseUrl/.well-known/openid-configuration'; + final oAuthUrl = '$baseUrl/.well-known/oauth-authorization-server'; + var fallbackUrl = oAuthUrl; + if (useOAuthAuthorizationServerLink) { - url = '$baseUrl/.well-known/oauth-authorization-server'; + fallbackUrl = url; + url = oAuthUrl; } try { @@ -1727,7 +1731,21 @@ class OIDC4VC { return data; } catch (e) { - throw Exception('AUTHORIZATION_SERVER_METADATA_ISSUE'); + try { + final response = await dioGet( + fallbackUrl, + isCachingEnabled: isCachingEnabled, + dio: dio, + secureStorage: secureStorage, + ); + final data = response is String + ? jsonDecode(response) as Map + : response as Map; + + return data; + } catch (e) { + throw Exception('AUTHORIZATION_SERVER_METADATA_ISSUE'); + } } }