Remove dynamic parameters stored in session on subsequent auth
See original GitHub issueHello,
I had a question about an issue that I’m experiencing with Grant right now (using grant-express 4.5.2, but it appears to function the same way in 5.x) … when I authenticate to a /connect
based endpoint that has been configured to use dynamic
parameters, they will be properly stored into the session. However, on subsequent auth requests to other providers, the dynamic
config sticks around in the session unless manually removed. This is true even if I explicitly unset dynamic
configuration using an empty array in the provider.
After looking through the code I believe it has to do with the fact that every connect
function also uses init
in lib/config, which in turn is using a deep-copy of the previous session and only overwriting session properties that were set to some sort of “truthy” value (or not in reserved words … e.g. “dynamic” is in there)
So my question really is … is there any way to unset these lingering session values on connect, or is it considered best practice to unset them manually on callback?
Thanks for your help! Eric
edit: Relevant code is:
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
I’m all set here - I upgraded to 4.7.0 last week and that solved the problem. Thanks again!
Hi @simov, thank you for the update! Yes that totally makes sense, and yes the connect URLs were coming out just fine. I did confirm that I’m in a version (4.5.2) where
req.session.grant
is being reused in the express handler initialization: https://github.com/simov/grant/blob/v4.5.2/lib/consumer/express.js#L27So I’ll try updating to 4.7.0, and I’ll let you know if I have any questions! Thanks for all your work on this project too, it’s worked great for me!