Crossmint / crossmint-sdk

Crossmint SDK for client and server integrations
https://demo.crossmint.io/
Apache License 2.0
27 stars 16 forks source link

Auth: Makes sure refresh token is received from Auth frame #766

Closed AlbertoElias closed 1 week ago

AlbertoElias commented 2 weeks ago

Description

We were creating the refresh token server side, but weren't using it in the client. This is the first step by receiving it from the auth frame.

This also stores the refresh token as a cookie with the correct expiry closing https://linear.app/crossmint/issue/WAL-2905/%5Brefresh-token%5D-store-refresh-token-in-the-client

And it uses the refresh token to call /refresh on page load and before jwt expires to always have up to date session token: https://linear.app/crossmint/issue/WAL-2931/%5Brefresh-token%5D-use-refresh-token-to-fetch-jwt

Test plan

Tested manually in combo with this pr and JWT is still fetched correctly and now we also receive the refresh token

Package updates

@crossmint/client-sdk-react-ui@1.3.20 @crossmint/common-sdk-base@1.2.7

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **smart-wallet-auth-demo** | ⬜️ Ignored ([Inspect](https://vercel.com/crossmint/smart-wallet-auth-demo/Cf2p3yCj78i7WNJmjgiVxHhJKnqh)) | [Visit Preview](https://smart-wallet-auth-demo-git-albertoe-wal-2920-r-7ca999-crossmint.vercel.app) | | Sep 24, 2024 4:59pm |
changeset-bot[bot] commented 2 weeks ago

🦋 Changeset detected

Latest commit: a0ad5dd0c22ede507c9e63022af8c4e6b312deec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages | Name | Type | | ------------------------------------------------ | ----- | | @crossmint/client-sdk-auth-core | Minor | | @crossmint/client-sdk-react-ui | Minor | | @crossmint/common-sdk-base | Minor | | @crossmint/client-sdk-react-ui-starter | Patch | | @crossmint/client-sdk-nextjs-starter | Patch | | @crossmint/client-sdk-smart-wallet-next-starter | Patch | | @crossmint/client-sdk-base | Patch | | @crossmint/client-sdk-vanilla-ui | Patch | | @crossmint/client-sdk-verifiable-credentials | Patch | | @crossmint/client-sdk-smart-wallet | Patch | | @crossmint/client-sdk-vue-ui-starter | Patch | | @crossmint/client-sdk-vue-ui | Patch | | @crossmint/client-sdk-smart-wallet-react-starter | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

AlbertoElias commented 2 weeks ago

Amazing PR, I left just some small comments 👍

Thanks! Replied to your comments!