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: pkce challenge support in React Native with Segment #772

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

MarceloPrado
Copy link
Contributor

@MarceloPrado MarceloPrado commented Aug 30, 2023

What kind of change does this PR introduce?

This PR fixes an issue where gotrue would throw in React Native due to the lack of the crypto and TextEncoder module.

When integrating Segment with React Native, they ask you to install react-native-get-random-values as a polyfill to crypto's getRandomValue method. This causes issues in gotrue, as the code does a simple crypto !== undefined check.

Since a lot of RN libraries polyfill only a subset of crypto's method, crypto !== undefined is not a bullet-proof way to check for support.

What is the current behavior?

If you have Segment installed, and try to login with supabase.auth.signInWithOtp (email), the app throws an error.

What is the new behavior?

If the required crypto modules are not available, it just fallbacks to plain text as the existing behavior instead of throwing an error.

@MarceloPrado MarceloPrado changed the title Fix gotrue crashing on ReactNative with Segment Fix gotrue throwing error in ReactNative with Segment Aug 30, 2023
@MarceloPrado MarceloPrado changed the title Fix gotrue throwing error in ReactNative with Segment Fix gotrue throwing error in React Native with Segment Aug 30, 2023
@hf hf changed the title Fix gotrue throwing error in React Native with Segment feat: pkce challenge support in React Native with Segment Sep 20, 2023
@kangmingtay
Copy link
Member

hey @MarceloPrado, apologies for the delay in reviewing but thanks for putting this together!

@kangmingtay kangmingtay merged commit b4494cb into supabase:master Oct 5, 2023
2 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

🎉 This PR is included in version 2.55.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@MarceloPrado
Copy link
Contributor Author

Thanks @kangmingtay! Any chance you could also review supabase/supabase-js#878 ?

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.

2 participants