Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/app-runtime/src/AppRuntimeErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down
10 changes: 8 additions & 2 deletions packages/app-runtime/src/AppStringProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down