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
beforeTokenSigning hook does not allow state to be changed.
Steps to Reproduce
run
const { OAuth2Server } = require('oauth2-mock-server');
(async () => {
let server = new OAuth2Server();
// Generate a new RSA key and add it to the keystore
await server.issuer.keys.generate('RS256');
server.service.once('beforeTokenSigning', (token, req) => {
token.payload.exp = token.payload.iat + 400;
});
// Start the server
await server.start(8080);
console.log(`OAuth 2 issuer is ${server.issuer.url}`);
})();
Hi @olegsmetanin! I'm able to reproduce your issue... but with a caveat.
When I run your test code for the first time, I get what you expect to happen (i.e. exp = iat + 400), but if I run it a second time, I get the default (exp = iat + 3600).
This should be expected, as your test code hooks on beforeTokenSigningonce.
Perhaps you meant to use server.service.on(...) instead of server.service.once(...)?
Summary
beforeTokenSigning hook does not allow state to be changed.
Steps to Reproduce
Found. Redirecting to http://localhost:8081/callback?code=8fcbdb52-f2ad-4f43-aaf3-501d45cc7723&state=state123
Expected Behavior
payload.exp is changed
Screenshots
Environment
oauth2-mock-server
version: (7.0.0)Additional Context
The text was updated successfully, but these errors were encountered: