generated from clerk/clerk-expo-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache.ts
More file actions
18 lines (16 loc) · 607 Bytes
/
cache.ts
File metadata and controls
18 lines (16 loc) · 607 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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: (key) => {
return SecureStore.getItemAsync(key);
},
saveToken: (key, token) => {
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;