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

Update README #637

Closed
Webbeh opened this issue Jun 27, 2022 · 6 comments
Closed

Update README #637

Webbeh opened this issue Jun 27, 2022 · 6 comments

Comments

@Webbeh
Copy link
Contributor

Webbeh commented Jun 27, 2022

SDK Version

8.2

PHP Version

Other (specify in 'additional context')

What happened?

The $auth0->exchange() method was updated in v8 to not return false anymore, but throw Exceptions.

It would be good to update the Requesting Tokens part of the README to be in accordance with those changes.

An example of those changes can be found in #524 (comment)

If we use the README's example, the only thing we get is an uncaught StateException.

How can we reproduce this issue?

Follow the readme as it is right now and try to use a previously logged in session.

Additional context

No response

@evansims
Copy link
Member

Thanks @Webbeh 👋 An oversight on my part in porting the documentation. I've updated the README to reflect expected usage now.

@Webbeh
Copy link
Contributor Author

Webbeh commented Jun 27, 2022

Anytime.
Thank you

@Webbeh
Copy link
Contributor Author

Webbeh commented Jun 28, 2022

What's the cleanest way to handle that exception?

I have customers who bookmarked the URL of the WebApp with the state and code URL parameter. If they end their session and they call that URL, the StateException is thrown every time.

Should I just replace the error message with a call to $auth0->clear(); followed by $auth0->login(); ?

@evansims
Copy link
Member

Hey @Webbeh 👋 That would work, just keep in mind that if you catch and redirect to login within your callback route, you could potentially create an infinite redirect loop if there are some weird circumstances, like the end user blocking cookies. Showing an interstitial page with an error message and offering to redirect the user back to your login route to try again would introduce an extra step, but might be a safer route.

@Webbeh
Copy link
Contributor Author

Webbeh commented Jun 28, 2022

Maybe I should redirect them to the logout page instead then.

That error would appear way too often - everyone who bookmarked a page including the code and state url parameters would be affected everytime they re-open a browser window using that bookmark, which is actually what made me notice the outdated README.

Getting rid of those parameters when bookmarking would probably be a better solution...

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants