Skip to content

GaryTowers/PHPOauth2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Oauth2 Sample

This is a small Oauth2 server that allows an external application (TestApp) to access important information. The process is simplified by just using a single endpoint (/auth) to start the flow internally and return an access token.

The project makes use of

  • PHP Slim: A small REST framework. On this project Slim is only used to handle http requests. All other functionality is handled by Oauth2 Library
  • Oauth2 Server Library: PHP library to implement Oauth2 flow
  • Plain PHP
  • MySQL

Install

  • Clone the project
  • Run composer install

Endpoints

[GET] /auth Asks the user to give access to TestApp to access protected information on his behalf Parameters:

  • response_type : code
  • client_id: TestApp
  • state: xyz

Example: [get] /auth?response_type=code&client_id=TestApp&state=xyz

[GET] /treasure Protected endpoint. Add query parameter access_token to access it

Assumptions

  • The user is already signed in
  • The only client registered is TestApp so the client_id is always TestApp
  • JSON is used for requests and responses

About

PHP Oauth 2 Sample

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages