Skip to content

Commit 8562cb2

Browse files
committed
added info about example
1 parent df82987 commit 8562cb2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,31 @@ The version 1.x of the PHP SDK now works with the Auth API v2 which adds lots of
2121

2222
>***Note:*** API V2 restrict the access to the endpoints via scopes. By default, the user token has granted certain scopes that let update the user metadata but not the root attributes nor app_metadata. To update this information and access another endpoints, you need an special token with this scopes granted. For more information about scopes, check [the API v2 docs](https://auth0.com/docs/apiv2Changes#6).
2323
24+
## Examples
25+
26+
Check the [basic-oauth](https://github.com/auth0/auth0-PHP/tree/master/examples/basic-oauth) example to see a quick demo on how the sdk works.
27+
You just need to create a `.env` file with the following information:
28+
29+
```
30+
AUTH0_CLIENT_SECRET=YOUR_APP_SECRET
31+
AUTH0_CLIENT_ID=YOU_APP_CLIENT
32+
AUTH0_DOMAIN=YOUR_DOMAIN.auth0.com
33+
AUTH0_CALLBACK_URL=http://localhost:3000/index.php
34+
AUTH0_APPTOKEN=A_VALID_APPTOKEN_WITH_CREATE_USER_SCOPE
35+
```
36+
37+
You will get your app client and secret from your Auth0 app you had created.
38+
The auth0 domain, is the one you pick when you created your auth0 account.
39+
You need to set this callback url in your app allowed callbacks.
40+
The app token is used in the 'create user' page and needs `create:users` scope. To create one, you need to use the token generator in the [API V2 documentation page](https://auth0.com/docs/apiv2)
41+
42+
To run the example, you need composer (the PHP package manager) installed (you can find more info about composer [here](https://getcomposer.org/doc/00-intro.md)) and run the following commands on the same folder than the code.
43+
44+
```
45+
$ composer install
46+
$ php -S localhost:3000
47+
```
48+
2449
## Migration guide from 0.6.6
2550

2651
1. First is important to read the [API v2 changes document](https://auth0.com/docs/apiv2Changes) to catch up the latest changes to the API.

0 commit comments

Comments
 (0)