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

allow to optionally pass redirect_uri into exchangeRefreshToken #1291

Merged
merged 3 commits into from
Dec 8, 2023

Conversation

pamapa
Copy link
Member

@pamapa pamapa commented Dec 7, 2023

Closes/fixes #1175

Removes the resource prop from the state and adds it into the args to pass down to the exchangeRefreshToken function. Treat resource, extraTokenParams and redirect_uri and any future prop the same way.

Checklist

  • This PR makes changes to the public API
  • I have included links for closing relevant issue numbers

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (78f36f7) 78.43% compared to head (7cf7bd7) 78.42%.

❗ Current head 7cf7bd7 differs from pull request most recent head 0997dd9. Consider uploading reports for the commit 0997dd9 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1291      +/-   ##
==========================================
- Coverage   78.43%   78.42%   -0.02%     
==========================================
  Files          45       45              
  Lines        1730     1729       -1     
  Branches      343      343              
==========================================
- Hits         1357     1356       -1     
  Misses        336      336              
  Partials       37       37              
Flag Coverage Δ
unittests 78.42% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pamapa pamapa added this to the 3.0.0 milestone Dec 7, 2023
Copy link

@ikeem07 ikeem07 left a comment

Choose a reason for hiding this comment

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

#1175

I downloaded this branch to my local and referenced it in two of my React apps. After some testing I can say that this is working as expected. I added a sigininSilent() call, which contained my redirect_uri, to the addAccessTokenExpiring event. Once it fired the redirect_uri appeared in the token renewal payload which properly refreshed my current token. I consider this change approved.

Example:

useEffect(() => {
    return auth.events.addAccessTokenExpiring(() => {
      auth.signinSilent(
        {
          redirect_uri: import.meta.env.VITE_B2C_REDIRECT_URI ?? ''
        }
      );
    });
  }, [auth.events, auth.signinSilent]);

@pamapa pamapa merged commit 74bb5b5 into main Dec 8, 2023
2 checks passed
@pamapa pamapa deleted the fix-1175 branch December 8, 2023 11:41
@pamapa
Copy link
Member Author

pamapa commented Dec 8, 2023

thanks for testing

@JORDAAAN1495
Copy link

@pamapa when do you think this will be available? Thanks for you're work on this

@pamapa
Copy link
Member Author

pamapa commented Dec 11, 2023

I plan do make a 3.0.0-rc.0 release this week.

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.

Include redirect_uri
3 participants