How to save user data when using external API #477
-
I'm trying to understand if its a good idea to write a adapter where it does REST API calls to the external instead of Database query calls to save the user data. Similar question would be #361 but i wonder if the above question are ideal. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Lucia doesn't care how the data is stored, just that it returns the data in the expected shape. I'm not sure if it's a good idea, but it's definitely possible. |
Beta Was this translation helpful? Give feedback.
-
@pilcrowonpaper Thanks for your quick reply. I also was wondering how would i validate the user since the lib are session based where my API is based on JWT auth 🤔 |
Beta Was this translation helpful? Give feedback.
If you're using single use keys, it's better if the database supported transactions.
Alternatively, you can just store the API token (I'm assuming that's the JWT) in a separate table and link it to a user.