-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e80e69
commit 8909e4b
Showing
12 changed files
with
867 additions
and
554 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 @@ | ||
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY= |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Stack } from "expo-router"; | ||
|
||
export default function HomeLayout() { | ||
return <Stack />; | ||
} |
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,26 @@ | ||
import { SignedIn, SignedOut, useUser } from "@clerk/clerk-expo"; | ||
import { Link } from "expo-router"; | ||
import { Text, View } from "react-native"; | ||
|
||
export default function Page() { | ||
const { user } = useUser(); | ||
|
||
return ( | ||
<View> | ||
<SignedIn> | ||
<Text>Welcome, {user?.emailAddresses[0].emailAddress}</Text> | ||
</SignedIn> | ||
<SignedOut> | ||
<View> | ||
<Text>Clerk 🤝 Expo</Text> | ||
<Link href="/sign-in"> | ||
<Text>Sign In</Text> | ||
</Link> | ||
<Link href="/sign-up"> | ||
<Text>Sign Up</Text> | ||
</Link> | ||
</View> | ||
</SignedOut> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as SecureStore from "expo-secure-store"; | ||
import { Platform } from "react-native"; | ||
import { TokenCache } from "@clerk/clerk-expo/dist/cache"; | ||
|
||
const createTokenCache = (): TokenCache => { | ||
return { | ||
getToken: async (key: string) => { | ||
try { | ||
const item = await SecureStore.getItemAsync(key); | ||
if (item) { | ||
console.log(`${key} was used 🔐 \n`); | ||
} else { | ||
console.log("No values stored under key: " + key); | ||
} | ||
return item; | ||
} catch (error) { | ||
console.error("secure store get item error: ", error); | ||
await SecureStore.deleteItemAsync(key); | ||
return null; | ||
} | ||
}, | ||
saveToken: (key: string, token: string) => { | ||
return SecureStore.setItemAsync(key, token); | ||
}, | ||
}; | ||
}; | ||
|
||
// SecureStore is not supported on the web | ||
// https://github.com/expo/expo/issues/7744#issuecomment-611093485 | ||
export const tokenCache = | ||
Platform.OS !== "web" ? createTokenCache() : undefined; |
Oops, something went wrong.