Library to generate API tokens without database |
(04-19-2023, 03:59 PM)grimpirate Wrote: You might not have access to a full-fledged database but you could always try using a sqlite backend. Store all of your tokens inside a table in the sqlite file. Use spark command line to manipulate that database for creation/deletion/etc of tokens. When a request comes in, check the for the Bearer token header and compare against your sqlite database, if authorized proceed, if not issue appropriate rejection. If you're referring to something like a JWT the process would be more involved, but for a basic random token you can use any sort of time based uuid or just bin2hex(random_bytes()). Great idea! I'll implement a sqlite db in the web app I've installed (through composer) this library. It allows to generate, validate, etc. JWT https://github.com/RobDWaller/ReallySimpleJWT So I'll store those tokens in the sqlite Thanks again
Enrique
https://beza.com.ar |
Messages In This Thread |
Library to generate API tokens without database - by kabeza - 04-19-2023, 05:21 AM
RE: Library to generate API tokens without database - by grimpirate - 04-19-2023, 03:59 PM
RE: Library to generate API tokens without database - by kabeza - 04-20-2023, 04:11 AM
|