Skip to content

Commit

Permalink
Only check response_type, etc. when no request/request_uri given.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Oct 23, 2023
1 parent bbdc42e commit d818cae
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/oid4vp.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,19 +750,21 @@ function _parseOID4VPUrl({url}) {
const nonce = _get(searchParams, 'nonce');
const response_uri = _get(searchParams, 'response_uri');
const state = _get(searchParams, 'state');
if(response_type !== 'vp_token') {
throw new Error(`Unsupported "response_type", "${response_type}".`);
}
if(response_mode !== 'direct_post') {
throw new Error(`Unsupported "response_type", "${response_type}".`);
}
if(request && request_uri) {
const error = new Error(
'Only one of "request" and "request_uri" may be present.');
error.name = 'DataError';
error.url = url;
throw error;
}
if(!(request || request_uri)) {
if(response_type !== 'vp_token') {
throw new Error(`Unsupported "response_type", "${response_type}".`);
}
if(response_mode !== 'direct_post') {
throw new Error(`Unsupported "response_type", "${response_type}".`);
}
}
const authorizationRequest = {
request,
request_uri,
Expand Down

0 comments on commit d818cae

Please sign in to comment.