Skip to content

Commit

Permalink
fix(expo): login on production
Browse files Browse the repository at this point in the history
  • Loading branch information
mrevanzak committed Dec 4, 2023
1 parent f9e6b65 commit 403b8bf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/expo/src/components/SignInButton.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
import React from "react";
import { Button, View } from "react-native-ui-lib";
import { makeRedirectUri } from "expo-auth-session";
import * as WebBrowser from "expo-web-browser";
import { useWarmUpBrowser } from "@/lib/hooks/useWarmUpBrowser";
import { toast } from "@backpackapp-io/react-native-toast";
import { useOAuth } from "@clerk/clerk-expo";

WebBrowser.maybeCompleteAuthSession();

export default function SignInButton() {
useWarmUpBrowser();

const { startOAuthFlow } = useOAuth({
strategy: "oauth_google",
redirectUrl: makeRedirectUri({
scheme: "vivat.marketplace.app",
path: "/",
}),
});

const handleSignInWithDiscordPress = React.useCallback(async () => {
const handleSignIn = React.useCallback(async () => {
try {
const { createdSessionId, setActive } = await startOAuthFlow();
if (createdSessionId) {
void setActive?.({ session: createdSessionId });
} else {
// Modify this code to use signIn or signUp to set this missing requirements you set in your dashboard.
throw new Error(
"There are unmet requirements, modifiy this else to handle them",
);
Expand All @@ -40,7 +43,7 @@ export default function SignInButton() {
size="medium"
bg-primary
className="w-1/2 p-3"
onPress={handleSignInWithDiscordPress}
onPress={handleSignIn}
/>
</View>
);
Expand Down

0 comments on commit 403b8bf

Please sign in to comment.