Skip to content

Commit 94aa904

Browse files
committed
📖
1 parent 023e376 commit 94aa904

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

docs/Usage/Using-examples.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ To install the required dependencies, create a `composer.json` in `/var/www/` wi
4242

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

45+
**Alternative: run the examples from a clone of the library**
46+
47+
Clone the library into a directory outside a public webroot - e.g. `/var/www/php-oauth/` and run `composer install` in the library root.
48+
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):
49+
50+
```apacheconf
51+
# create an alias "public" -> https://example.com/oauth/
52+
Alias /oauth "/var/www/php-oauth/public/"
53+
54+
<Directory "/var/www/php-oauth/public/">
55+
# ...additional configuration...
56+
</Directory>
57+
```
58+
59+
(please **do not** expose the whole library to a public URL)
60+
4561

4662
### Configuration
4763

examples/example-oauth1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
}
6565
// step 4: verify the token and use the API
6666
elseif(isset($_GET['granted']) && $_GET['granted'] === $name){
67-
// use the file storage from now on
67+
// use the permanent storage from now on
6868
// [...]
6969

7070
// dump the AuthenticatedUser instance

examples/example-oauth2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
}
7373
// step 4: verify the token and use the API
7474
elseif(isset($_GET['granted']) && $_GET['granted'] === $name){
75-
// use the file storage from now on
75+
// use the permanent storage from now on
7676
// [...]
7777

7878
// dump the AuthenticatedUser instance

public/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
/**
3-
* OAuth test entry point
3+
* OAuth test/example entry point
4+
*
5+
* @link https://php-oauth.readthedocs.io/en/main/Usage/Using-examples.html
46
*
57
* @created 22.03.2024
68
* @author smiley <[email protected]>

0 commit comments

Comments
 (0)