-
Notifications
You must be signed in to change notification settings - Fork 364
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
Refactor logout to use buildLogoutUrl #595
Refactor logout to use buildLogoutUrl #595
Conversation
Added a few more comments. Thanks for the PR @rnwolfe , appreciate the work. I think we are almost to a point where we can get this approved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more things before we can get this merged.
Thanks again for making all the changes!
Thanks, this looks great @rnwolfe! 🎉 I will give this a last round of testing first thing tomorrow (getting a bit late here). |
Sounds good @frederikprijck! 👍 Thanks for your promptness. I'll keep an eye on things for tomorrow. I did just notice a failed cypress test in the CI on the last commit but it may be a fluke as it was successful in my environment. |
@rnwolfe CI is fine, it appears to have been a flake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, one minor test cleanup and we should be ready to go.
Co-authored-by: Steve Hobbs <[email protected]>
Made the last couple of changes 👍 |
@rnwolfe Looks good, could you merge in master in your branch? |
…eature/build-logout-url
@frederikprijck merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! 🎉
@frederikprijck sorry to bolt on to the PR, but when trying to install the new committed version in npm (
The same was true when I tried from my fork, but this seems off as I have it installed globally, as well as it being in the local Am I missing something here? I'm trying to use this in my app prior to npm release. Thanks for any advice. |
I dont think this is supposed to be installed like that, as our artifacts published to npm are different from what we have in the repo (like we bundle things using rollup). I think the easiest would be to checkout your branch locally (or the current master), build it and use npm or yarn link to link the To some degree this is comparable to building and moving the files to the node_nodules, instead it doesnt involve manual copying but symlinking. Something like this:
More info However, this only helps u for local development. We should be shipping a new release early next week tho. |
@frederikprijck I see, thanks. I'll check that out for the time being. |
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
This PR seeks to build a logout URL builder function (
buildLogoutUrl
) that thelogout
function then uses. This is in line with the changes made forbuildAuthorizeUrl
andauthorize
in #280. This allows for custom handling of launching the URL instead of only usingwindow.location.assign
. This allows for easier support of hybrid apps using things like Cordova or Capacitor.Note: PR #273 sought to do this, but I re-worked it a bit based on the comments on my own fork.
References
Testing
__tests__/index.test.ts
has been updated accordingly to mirror the changes made toAuth0Client
.One notable thing was in the Jest tests, the
expectToHaveBeenCalledWithAuth0ClientParam
was catching two mocks (one from the prior function). The logged output below:This was bewildering to me and was only happening for this test:
https://github.com/ironbow/auth0-spa-js/blob/6ff9ece3a78d5e7db855d37ef45e649184257a45/__tests__/index.test.ts#L2236-L2244
My means of getting around this was updating the helper function to references the last mock result in the array, rather than assuming there is only one:
https://github.com/ironbow/auth0-spa-js/blob/1054ba48d8054a97dda0ed6e6fbc83fd46b6b8f1/__tests__/helpers.ts#L2
This may not be an appropriate fix, but I could not figure out what was causing it as the mocks should be cleared after each test.
Checklist
master