Skip to content

Commit

Permalink
📖
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed May 20, 2024
1 parent 023e376 commit 94aa904
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
16 changes: 16 additions & 0 deletions docs/Usage/Using-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ To install the required dependencies, create a `composer.json` in `/var/www/` wi

After that, copy the `examples` directory in the library root to `/var/www/oauth-examples/`.

**Alternative: run the examples from a clone of the library**

Clone the library into a directory outside a public webroot - e.g. `/var/www/php-oauth/` and run `composer install` in the library root.
Now add an alias to your webserver configuration that points to `[library root]/public`, here an example for [Apache](https://httpd.apache.org/docs/2.4/mod/core.html#directory):

```apacheconf
# create an alias "public" -> https://example.com/oauth/
Alias /oauth "/var/www/php-oauth/public/"
<Directory "/var/www/php-oauth/public/">
# ...additional configuration...
</Directory>
```

(please **do not** expose the whole library to a public URL)


### Configuration

Expand Down
2 changes: 1 addition & 1 deletion examples/example-oauth1.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}
// step 4: verify the token and use the API
elseif(isset($_GET['granted']) && $_GET['granted'] === $name){
// use the file storage from now on
// use the permanent storage from now on
// [...]

// dump the AuthenticatedUser instance
Expand Down
2 changes: 1 addition & 1 deletion examples/example-oauth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}
// step 4: verify the token and use the API
elseif(isset($_GET['granted']) && $_GET['granted'] === $name){
// use the file storage from now on
// use the permanent storage from now on
// [...]

// dump the AuthenticatedUser instance
Expand Down
4 changes: 3 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
/**
* OAuth test entry point
* OAuth test/example entry point
*
* @link https://php-oauth.readthedocs.io/en/main/Usage/Using-examples.html
*
* @created 22.03.2024
* @author smiley <smiley@chillerlan.net>
Expand Down

0 comments on commit 94aa904

Please sign in to comment.