Session or database is fine. It depends on the livecycle of the token. Is it a temporary token then store it in the session. Is it a token you need to use the rest of the year? Store it in the database. Make sure you encrypt the token before you store it ;)
Consuming REST API in PHP with Guzzle
Consuming REST API in PHP with Guzzle. In my situation, I'm consuming a REST API with Guzzle HTTP client. I however not sure the recommended way of storing the authentication token. Is sessions the right way to go? What is the recommended approach in a situation like this?
@ultrasamad It's disabled by default for API's by Laravel. If you open '
app/Http/Kernel.php you can see that the api group does not have a session middleware and that the web group does have a session middleware.
Your API does not need a session most of the time. If it does you can simply add the session middleware and you're done!
Please or to participate in this conversation.