Skip to content

Latest commit

 

History

History

php_oauth_server

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PHP OAuth 2 Server

Configuration and Setup

  1. Ensure you have PHP 8+ installed
  2. Ensure you have Composer installed from https://getcomposer.org/
  3. Run composer install (or your equivalent) in this directory to install dependencies
  4. Create a private key openssl genrsa -out private.key 2048
  5. Create a public key openssl rsa -in private.key -pubout > public.key
  6. cd into the public directory
  7. Start the PHP server with php -S localhost:4444

Caveats and Warnings

  1. Our only user is hardcoded in examples\Repositories\UserRepository.php on line 27. In a real implementation, that method would call a database or other user store for password verification.
  2. Our only OAuth Client is hardcoded in examples\Repositories\ClientRepository.php on line 42. In a real implementation, that method would call a database or other list of OAuth clients to validate the client_id and client_secret.
  3. Our allowed scopes are hardcoded in examples\Repositories\ScopeRepository.php starting on line 21. In a real implementation, that method would call a database or other list of scopes to grant.