biff

macrobartfast 2024-10-29T06:25:41.001669Z

More of a general webdev rather than a Biff question here, as usual. Or, maybe just a sanity check to make sure there’s no baked in functionality I might inadvertently recreate… I want to let users hit API route endpoints with a key they can create as part of their account. Do I modify the user schema to add that to each user? Then I could, I guess, create a route that handles a create/recreate-an-api-key form. Any tips/cautions welcome.

hadils 2024-10-29T13:25:31.921819Z

This is not a bad solution. However, there might be times when there are more than one user logged into an account. When I implemented this in my own codebase, I used a separate schema that had a token and an entity ID for the user (also the scope which is useful if you use the tokens for different things and the expiry date).

macrobartfast 2024-10-29T18:54:29.898899Z

That sounds solid. I was wondering if a different schema would be wise. Especially as one can more easily have multiple keys with different scopes. Also, be able to move into tokens more readily should one want to. With that direction in mind, I wonder if there are libraries for handling this.