-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into stefanos/eco-257-add-a-docs-page-for-enablin…
…g-offline-support
- Loading branch information
Showing
68 changed files
with
1,035 additions
and
1,010 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The [`<ClerkProvider>`](/docs/components/clerk-provider) component provides session and user context to Clerk's hooks and components. It's recommended to wrap your entire app at the entry point with `<ClerkProvider>` to make authentication globally accessible. See the [reference docs](/docs/components/clerk-provider) for other configuration options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
The following example demonstrates how to create a custom OAuth sign-in flow for [Google accounts](/docs/authentication/social-connections/google). | ||
|
||
```tsx {{ filename: 'app/(auth)/sign-in.tsx', collapsible: true }} | ||
import React from 'react' | ||
import * as WebBrowser from 'expo-web-browser' | ||
import { Text, View, Button } from 'react-native' | ||
import { Link } from 'expo-router' | ||
import { useOAuth } from '@clerk/clerk-expo' | ||
import * as Linking from 'expo-linking' | ||
|
||
export const useWarmUpBrowser = () => { | ||
React.useEffect(() => { | ||
// Warm up the android browser to improve UX | ||
// https://docs.expo.dev/guides/authentication/#improving-user-experience | ||
void WebBrowser.warmUpAsync() | ||
return () => { | ||
void WebBrowser.coolDownAsync() | ||
} | ||
}, []) | ||
} | ||
|
||
WebBrowser.maybeCompleteAuthSession() | ||
|
||
export default function Page() { | ||
useWarmUpBrowser() | ||
|
||
const { startOAuthFlow } = useOAuth({ strategy: 'oauth_google' }) | ||
|
||
const onPress = React.useCallback(async () => { | ||
try { | ||
const { createdSessionId, signIn, signUp, setActive } = await startOAuthFlow({ | ||
redirectUrl: Linking.createURL('/dashboard', { scheme: 'myapp' }), | ||
}) | ||
|
||
// If sign in was successful, set the active session | ||
if (createdSessionId) { | ||
setActive!({ session: createdSessionId }) | ||
} else { | ||
// Use signIn or signUp returned from startOAuthFlow | ||
// for next steps, such as MFA | ||
} | ||
} catch (err) { | ||
// See https://clerk.com/docs/custom-flows/error-handling | ||
// for more info on error handling | ||
console.error(JSON.stringify(err, null, 2)) | ||
} | ||
}, []) | ||
|
||
return ( | ||
<View> | ||
<Link href="/"> | ||
<Text>Home</Text> | ||
</Link> | ||
<Button title="Sign in with Google" onPress={onPress} /> | ||
</View> | ||
) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.