Skip to content

Commit 8be4645

Browse files
committed
feat: use WP-Auth0 domain option
1 parent 6118153 commit 8be4645

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ First, install the [Login by Auth0 plugin](https://wordpress.org/plugins/auth0/)
1414

1515
```php
1616
// Auth0 credentials
17-
define( 'AUTH0_DOMAIN', 'Your Auth0 domain' );
1817
define( 'AUTH0_API_AUDIENCE', 'API identifier for the WP REST API' );
1918
define( 'AUTH0_API_SIGNING_SECRET', 'API signing secret from Auth0' );
2019
define( 'AUTH0_API_DEBUG', 'Set to `true` to add debugging log entries' );
@@ -42,7 +41,7 @@ You can get this running to test it out locally with Docker using [this Gist](ht
4241

4342
## Troubleshooting
4443

45-
Try setting `AUTH0_API_DEBUG` to `true` and watching your PHP error log for information on failures.
44+
Try setting `AUTH0_API_DEBUG` to `true` and watching your WP error log for information on failures.
4645

4746
If API requests aren't working, Apache might not be passing authorization headers to PHP. Try adding this line (or similar methods) to `.htaccess`:
4847

src/wp-rest-api-auth0.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function determine_current_user( $user ) {
6363
// Verify the incoming JWT access token.
6464
// Auth0-generated access tokens for users will be ID token shaped.
6565
$token_verifier = new \WP_Auth0_IdTokenVerifier(
66-
'https://' . \AUTH0_DOMAIN . '/',
66+
'https://' . \WP_Auth0_Options::Instance()->get('domain') . '/',
6767
\AUTH0_API_AUDIENCE,
6868
new \WP_Auth0_SymmetricVerifier( \AUTH0_API_SIGNING_SECRET )
6969
);
@@ -78,6 +78,8 @@ function determine_current_user( $user ) {
7878
return null;
7979
}
8080

81+
82+
8183
// We don't have a user to associate this call to.
8284
if ( ! $decoded_token['sub'] ) {
8385
if ( $debug_mode ) {

0 commit comments

Comments
 (0)