You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The result of this is not the client secret arriving at the getClient method, but the url encoded version of it, which in my case was base64 encoded so it was changed and the getClient method failed.
I think handling it in the model is not problematic but unnecessary so it should be done in the library
"Workaround"
classModel{asyncgetClient(clientId: string,clientSecret: string|null): Promise<Client|Falsey>{constclientIdDecoded=decodeURIComponent(clientId);constclientSecretDecoded=clientSecret ? decodeURIComponent(clientSecret) : null;// use clientIdDecoded and clientSecretDecoded in your database logic instead of clientId and clientSecret}}
The text was updated successfully, but these errors were encountered:
Hi @MaximilianGaedig since the encoding of the secret is entirely part of the surrounding implementation, so is the decoding, too. We can't make any assumptions beyond the OAuth2 standard, which is why the model is one place where this should could be done. However, note, that your token endpoint could also be a place to handle such.
constserver=newOAuth2Server({ model })// ...other endpoints// this could be added to express or other middlewareconsttokenEndpoint=function(req,res,next){constclientSecret=req.body.clientSecret??null;req.body.clientSecret=clientSecret ? decodeURIComponent(clientSecret) : null;constrequest=newRequest(req);constresponse=newResonse(res);server.token(request,response,options).then(function(code){// ...}).catch(function(err){// ...});}
Here getClientCredentials takes request.body.client_id and request.body.client_secret without calling decodeURIComponent() on them:
The result of this is not the client secret arriving at the getClient method, but the url encoded version of it, which in my case was base64 encoded so it was changed and the getClient method failed.
I think handling it in the model is not problematic but unnecessary so it should be done in the library
"Workaround"
The text was updated successfully, but these errors were encountered: