@@ -125,18 +125,34 @@ async function storeRp(
125125 return rp
126126}
127127
128- function registerRp (
129- idp : string ,
130- { storage, callbackUri } : loginOptions
131- ) : Promise < RelyingParty > {
128+ function registerRp ( idp : string , opts : loginOptions ) : Promise < RelyingParty > {
129+ const { storage , callbackUri } = opts
132130 const responseType = 'id_token token'
131+
132+ const clientNameI18n = { }
133+ Object.entries(opts)
134+ .filter(([key, _]) => key . startsWith ( 'clientName#' ) )
135+ . forEach (
136+ ( [ key , value ] ) =>
137+ ( clientNameI18n [ key . replace ( 'clientName#' , 'client_name#' ) ] = value )
138+ )
139+
140+ const supplementaryOptions = {
141+ logo_uri : opts . logoUri ,
142+ contacts : opts . contacts ,
143+ client_name : opts . clientName
144+ }
145+
133146 const registration = {
134147 issuer : idp ,
135148 grant_types : [ 'implicit' ] ,
136149 redirect_uris : [ callbackUri ] ,
137150 response_types : [ responseType ] ,
138- scope : 'openid profile'
151+ scope : 'openid profile' ,
152+ ...clientNameI18n ,
153+ ...supplementaryOptions
139154 }
155+
140156 const options = {
141157 defaults : {
142158 authenticate : {
@@ -146,6 +162,7 @@ function registerRp(
146162 } ,
147163 store : storage
148164 }
165+
149166 return RelyingParty . register ( idp , registration , options )
150167}
151168
0 commit comments