Need to add custom endpoints for /me and /refresh-token ? #12
-
Hey, I am wondering if you need to implement custom endpoints for /me /refresh-token and so to account for that the 'exp' claim is stored in the account? Basically, when I've been trying to implement authjs I run into an issue with payloads useAuth is based on the result from those endpoints but AuthJS is using auth() wrapper so there is a missmatch between certain visual changes in the GUI. And for the plugin to be useful I think some consideration or guidance on how to combine or work with payload auth context would be good. I also decided to add 'linkAccount' to my user field holding whenever exp updates, and the account that was used during sign-in, in case there are multiple accounts would know which one to use.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Thanks for your contribution. I already implemented a custom Yes, you are right, i need to register a custom The And finally, now i offer a |
Beta Was this translation helpful? Give feedback.
-
Would just like to state that if you do end up adding a refresh-endpoint you would probably need to provide a callback option in the config so that users can provide the refresh function.
Then in the custom refresh-endpoint you would update the account on success. |
Beta Was this translation helpful? Give feedback.
Thanks for your contribution.
I already implemented a custom
/me
endpoint, but it was only registering when you using a virtual field and there was another error with theexp
value. Now both should be fixed.Yes, you are right, i need to register a custom
/refresh-token
endpoint to refresh the Auth.js session. It is also included in the new versionv0.7.1
.The
useAuth
hook from payload can be used in the admin panel as mentioned in the payload documentation. With a few tweaks you can also use it in your own application, but I would not recommend this. If you have a specific problem with this, please open an issue and provide more informations.And finally, now i offer a
usePayloadSession
β¦