README.md
1# OpenID Connect Example implementations
2The following examples piggyback off the PHP Leagues OAuth2 Server examples. Please follow the instructions below carefully.
3
4## Installation
5
60. Run `composer install --prefer-source` in this directory to install dependencies
70. Create a private key `openssl genrsa -out private.key 2048`
80. Create a public key `openssl rsa -in private.key -pubout > public.key`
90. Change permissions of the .key files or a PHP Notice will be thrown `chmod 660 *.key`
100. `cd` into the public directory
110. Start a PHP server `php -S localhost:4444`
12
13## Testing the client credentials grant example
14
15Send the following cURL request:
16
17```
18curl -X "POST" "http://localhost:4444/client_credentials.php/access_token" \
19 -H "Content-Type: application/x-www-form-urlencoded" \
20 -H "Accept: 1.0" \
21 --data-urlencode "grant_type=client_credentials" \
22 --data-urlencode "client_id=myawesomeapp" \
23 --data-urlencode "client_secret=abc123" \
24 --data-urlencode "scope=openid email"
25```
26
27## Testing the password grant example
28
29Send the following cURL request:
30
31```
32curl -X "POST" "http://localhost:4444/password.php/access_token" \
33 -H "Content-Type: application/x-www-form-urlencoded" \
34 -H "Accept: 1.0" \
35 --data-urlencode "grant_type=password" \
36 --data-urlencode "client_id=myawesomeapp" \
37 --data-urlencode "client_secret=abc123" \
38 --data-urlencode "username=alex" \
39 --data-urlencode "password=whisky" \
40 --data-urlencode "scope=openid email"
41```
42