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

feat(clerk-expo): Add secure token cache implementation and rename secureStore #5375

Merged
merged 22 commits into from
Mar 18, 2025

Conversation

wobsoriano
Copy link
Member

@wobsoriano wobsoriano commented Mar 17, 2025

Description

This PR introduces a default secure token cache (basically what's in our quickstart) and deprecates secureStore in favor of resourceCache for the experimental offline support.

import { ClerkProvider } from '@clerk/clerk-expo'

// copy-pasted from our recommended secure token cache from the expo quickstart
import { tokenCache } from '@clerk/clerk-expo/token-cache'

// Previously secureStore from @clerk/clerk-expo/secure-store, renamed
// to avoid confusion with the token cache implementation above
import { resourceCache } from '@clerk/clerk-expo/resource-cache'

export default function RootLayout() {
  return (
    <ClerkProvider
      publishableKey="your-publishable-key"
      tokenCache={tokenCache}
      __experimental_resourceCache={resourceCache}
    >
      {...}
    </ClerkProvider>
  )
}

Resolves ECO-510

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

changeset-bot bot commented Mar 17, 2025

🦋 Changeset detected

Latest commit: 81c632a

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

This PR includes changesets to release 1 package
Name Type
@clerk/clerk-expo Minor

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

Copy link

vercel bot commented Mar 17, 2025

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ⬜️ Skipped (Inspect) Mar 18, 2025 7:17pm

Comment on lines 103 to 105
},
"expo-secure-store": {
"optional": true
Copy link
Member

Choose a reason for hiding this comment

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

We should remove this in the next major, because if someone is not using this package they will get errors when updating their package.

Copy link
Member Author

@wobsoriano wobsoriano Mar 18, 2025

Choose a reason for hiding this comment

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

Good catch and I agree. Updated. thanks!

Copy link
Member

@panteliselef panteliselef left a comment

Choose a reason for hiding this comment

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

Seems like we are not deprecating properly. And we are introducing breaking changes since secureStore is no longer exported from the expected path.

const item = await SecureStore.getItemAsync(key);
return item;
} catch (error) {
console.error('Clerk: Failed to retrieve token from SecureStore:', error);
Copy link
Member

Choose a reason for hiding this comment

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

I'd remove that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed 👍🏼

Copy link
Member

@panteliselef panteliselef left a comment

Choose a reason for hiding this comment

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

:shipit:

@wobsoriano wobsoriano force-pushed the rob/eco-510-simplify-cache-exports branch from 25b7130 to e539a3c Compare March 18, 2025 19:10
@wobsoriano wobsoriano merged commit 13e3ddc into main Mar 18, 2025
30 checks passed
@wobsoriano wobsoriano deleted the rob/eco-510-simplify-cache-exports branch March 18, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants