Bearer token authentication without database? |
I have a web application built on CI 4.3.x, focused on API calls to a server. Recently, I received a request to add REST API endpoints using the ResourceController class. Initially, I implemented a simple Basic Authorization check on these endpoints, but now I want to take it a step further and add Bearer token authentication.
The challenge I'm facing is that libraries like Shield require me to set up a database, and the server hosting the web app does not have any database support. Is there any library or classes available that would allow me to: Manually generate tokens and store them in a config file or .env file. Implement Bearer token authentication for these endpoints. Perform token decoding, validation, and other necessary operations. I'd greatly appreciate any suggestions or guidance regarding this matter. Thank you in advance for your help! (07-26-2023, 12:38 AM)MahilaTeekshna Wrote: The challenge I'm facing is that libraries like Shield require me to set up a database, and the server hosting the web app does not have any database support. 1. Shield allows you to connect to any database (not necessarily the service where your app is hosted). So if your service (app) does not support database, you can connect the shield to the service that is supported by the database. I mean using two separate servers (one to host the app and another to host the database) 2. Second solution, try to use sqlite: ```env database.default.database = ../writable/database.db database.default.DBDriver = SQLite3 ``` I hope you succeed with one of the methods above. |
Welcome Guest, Not a member yet? Register Sign In |