diff --git a/packages/oidc4vc/lib/src/oidc4vc.dart b/packages/oidc4vc/lib/src/oidc4vc.dart index 324e51664..8d1ed0d92 100644 --- a/packages/oidc4vc/lib/src/oidc4vc.dart +++ b/packages/oidc4vc/lib/src/oidc4vc.dart @@ -1781,8 +1781,6 @@ class OIDC4VC { ///the wallet is the authorization server the verifier metadata are in ////openid-configuration - final url = '$baseUrl/.well-known/openid-configuration'; - if (!isAuthorizationServer) { final data = await getOpenIdConfigSecondMethod( baseUrl, @@ -1793,6 +1791,8 @@ class OIDC4VC { return data; } + final url = '$baseUrl/.well-known/oauth-authorization-server'; + try { final response = await dioGet( url, @@ -1820,6 +1820,36 @@ class OIDC4VC { required bool isCachingEnabled, required Dio dio, SecureStorageProvider? secureStorage, + }) async { + final url = '$baseUrl/.well-known/openid-configuration'; + + try { + final response = await dioGet( + url, + isCachingEnabled: isCachingEnabled, + dio: dio, + secureStorage: secureStorage, + ); + final data = response is String + ? jsonDecode(response) as Map + : response as Map; + + return OpenIdConfiguration.fromJson(data); + } catch (e) { + final data = await getOpenIdConfigThirdMethod( + baseUrl, + isCachingEnabled: isCachingEnabled, + dio: dio, + ); + return data; + } + } + + Future getOpenIdConfigThirdMethod( + String baseUrl, { + required bool isCachingEnabled, + required Dio dio, + SecureStorageProvider? secureStorage, }) async { final url = '$baseUrl/.well-known/openid-credential-issuer';