@@ -73,6 +73,7 @@ export async function createSignedAuthRequestWhenNeeded(requestObject: Record<st
7373 requestObject [ 'request' ] = pop . jwt ;
7474 }
7575}
76+
7677function filterSupportedCredentials (
7778 credentialOffer : CredentialOfferPayloadV1_0_13 ,
7879 credentialsSupported ?: Record < string , CredentialConfigurationSupportedV1_0_13 > ,
@@ -200,19 +201,28 @@ export const createAuthorizationRequestUrl = async ({
200201 authorization_details : JSON . stringify ( handleAuthorizationDetails ( endpointMetadata , authorizationDetails ) ) ,
201202 ...( redirectUri && { redirect_uri : redirectUri } ) ,
202203 ...( client_id && { client_id } ) ,
203- ...( credentialOffer ?. issuerState && { issuer_state : credentialOffer . issuerState } ) ,
204+
205+ ...( credentialOffer ?. issuerState && {
206+ issuer_state : credentialOffer . issuerState ,
207+ } ) ,
204208 scope : authorizationRequest . scope ,
205209 } ;
206210
211+ if ( credentialOffer ?. issuerState ) {
212+ /* We also pass it in as state, as this would allow an external AS without integration to return it back to the wallet */
213+ queryObj . state = credentialOffer ?. issuerState ;
214+ }
215+
207216 if ( ! parEndpoint && parMode === PARMode . REQUIRE ) {
208217 throw Error ( `PAR mode is set to required by Authorization Server does not support PAR!` ) ;
209218 } else if ( parEndpoint && parMode !== PARMode . NEVER ) {
210219 debug ( `USING PAR with endpoint ${ parEndpoint } ` ) ;
220+
211221 const parResponse = await formPost < PushedAuthorizationResponse > (
212222 parEndpoint ,
213223 convertJsonToURI ( queryObj , {
214224 mode : JsonURIMode . X_FORM_WWW_URLENCODED ,
215- uriTypeProperties : [ 'client_id' , 'request_uri' , 'redirect_uri' , 'scope' , 'authorization_details' , 'issuer_state' ] ,
225+ uriTypeProperties : [ 'client_id' , 'request_uri' , 'redirect_uri' , 'scope' , 'authorization_details' , 'issuer_state' , 'state' ] ,
216226 } ) ,
217227 { contentType : 'application/x-www-form-urlencoded' , accept : 'application/json' } ,
218228 ) ;
@@ -232,7 +242,7 @@ export const createAuthorizationRequestUrl = async ({
232242 debug ( `Object that will become query params: ` + JSON . stringify ( queryObj , null , 2 ) ) ;
233243 const url = convertJsonToURI ( queryObj , {
234244 baseUrl : endpointMetadata . authorization_endpoint ,
235- uriTypeProperties : [ 'client_id' , 'request_uri' , 'redirect_uri' , 'scope' , 'authorization_details' , 'issuer_state' ] ,
245+ uriTypeProperties : [ 'client_id' , 'request_uri' , 'redirect_uri' , 'scope' , 'authorization_details' , 'issuer_state' , 'state' ] ,
236246 // arrayTypeProperties: ['authorization_details'],
237247 mode : JsonURIMode . X_FORM_WWW_URLENCODED ,
238248 // We do not add the version here, as this always needs to be form encoded
0 commit comments