In order to construct a secure resource that can be accessed through an API, we must utilize an authorization header with a token or bearer. In this article, I will guide you how to obtain the authorization header, extract the token or bearer. Then authenticate it against a database table and return a JSON output in PHP.
Most of the default installations of Nextcloud goes with MySQL/MariaDB, but Nextcloud support other databases too like PostgreSQL and SQLite. I will show you how to install Nextcloud with PostgreSQL on Ubuntu 22.04 in this article with Apache and PHP.
I will show you how to install and setup Nextcloud 24 on Rocky Linux 9 in this article, which was released last month. I have already wrote an article about setting up a web server on Rocky Linux 9, we will continue from there. Click on the button below to install the basics first.
Rocky Linux 9 comes with PHP 8.0 as default and base package. Even 8.0 is fine to use, but there maybe time you would like to update to latest stable release at hand to test your app. Read on how to upgrade to PHP 8.1 on Rocky Linux 9 the easy way.