Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CR: Register and trigger custom wp_action upon token failure #907

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

ramonschriks
Copy link
Contributor

@ramonschriks ramonschriks commented Jun 20, 2024

PR: Adding a custom hook upon token exchange failure creates to ability to add custom logic (such as redirecting to a custom unauthorized/forbidden page).

Moved the default logic when token exchange fails (redirect to '/'), to default action hook, and added custom action in registry so it gets registered.

Within WordPress, dev's can opt-in to this action so behaviour like this can be done whenever the token exchange fails (in our case we want to force a logout at auth0):

add_action('auth0_token_exchange_failed', function ( $throwable ) {
	do_action( 'auth0_logout' );
   }, 1
);

By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

Describe the purpose of this PR along with any background information and the impacts of the proposed change. For the benefit of the community, please do not assume prior context.

Provide details that support your chosen implementation, including: breaking changes, alternatives considered, changes to the API, etc.

If the UI is being changed, please provide screenshots.

References

Include any links supporting this change such as a:

  • GitHub Issue/PR number addressed or fixed
  • Auth0 Community post
  • StackOverflow post
  • Support forum thread
  • Related pull requests/issues from other repos

If there are no references, simply delete this section.

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not the default branch

@ramonschriks ramonschriks requested a review from a team as a code owner June 20, 2024 09:52
Copy link
Member

@evansims evansims left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@evansims evansims merged commit 78a1f3e into auth0:5.x Jun 24, 2024
2 checks passed
@ramonschriks
Copy link
Contributor Author

@evansims Do you have any idea when a new release with this feature will be enrolled? Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants