diff --git a/packages/app-runtime/src/AppRuntimeErrors.ts b/packages/app-runtime/src/AppRuntimeErrors.ts index 345458e97..0674edefc 100644 --- a/packages/app-runtime/src/AppRuntimeErrors.ts +++ b/packages/app-runtime/src/AppRuntimeErrors.ts @@ -28,6 +28,10 @@ class AppStringProcessor { return new ApplicationError("error.appruntime.appStringProcessor.passwordNotProvided", "No password was provided."); } + public invalidCredentialOffer(): ApplicationError { + return new ApplicationError("error.appruntime.appStringProcessor.invalidCredentialOffer", "The scanned code contains an invalid credential offer."); + } + public externalOauthRegistrationNotProvided(): ApplicationError { return new ApplicationError("error.appruntime.appStringProcessor.externalOauthRegistrationNotProvided", "No external OAuth registration was provided."); } diff --git a/packages/app-runtime/src/AppStringProcessor.ts b/packages/app-runtime/src/AppStringProcessor.ts index ae82ff575..554899baa 100644 --- a/packages/app-runtime/src/AppStringProcessor.ts +++ b/packages/app-runtime/src/AppStringProcessor.ts @@ -100,8 +100,14 @@ export class AppStringProcessor { return Result.ok(undefined); } - // TODO: Multiple authorization servers not supported yet - const tokenResult = await uiBridge.performOauthAuthentication(credentialOffer.metadata.authorizationServers[0].issuer); + const authorizationServer = credentialOffer.credentialOfferPayload.grants!.authorization_code!.authorization_server; + if (!authorizationServer) { + await uiBridge.showError(AppRuntimeErrors.appStringProcessor.invalidCredentialOffer()); + this.logger.error("Credential offer does not contain an authorization server", credentialOffer); + return Result.ok(undefined); + } + + const tokenResult = await uiBridge.performOauthAuthentication(authorizationServer); if (tokenResult.isError) { this.logger.error("Could not perform OAuth authentication", tokenResult.error); return Result.ok(undefined);