totalNoob
totalNoob

Reputation: 39

I am getting “network_error” while attempting oauth SignIn using clerk

I can login and signup fine in my react native expo app. but when i try to login with the clerk o_auth, i am getting an error:

{
     "code": "network_error",
     "clerkRuntimeError": true
}

This is my oauth setup:

import { useOAuth, isClerkAPIResponseError } from '@clerk/clerk-expo';
import { Ionicons } from '@expo/vector-icons';
import * as Linking from 'expo-linking';
import * as WebBrowser from 'expo-web-browser';
import React, { useCallback } from 'react';
import { Pressable, Alert } from 'react-native';

import { HStack } from '../sharedComponents';

import { Text } from '~/components/ui/text';
import { useWarmUpBrowser } from '~/hooks/warmUpBrowser';

WebBrowser.maybeCompleteAuthSession();

export const GoogleOauthSignIn = () => {
  useWarmUpBrowser();
  const { startOAuthFlow: startGoogleFlow } = useOAuth({ strategy: 'oauth_google' });
  const onSignInWithGoogle = useCallback(async () => {
    try {
      const { createdSessionId, signIn, signUp, setActive } = await startGoogleFlow();
      if (createdSessionId && setActive) {
        setActive({ session: createdSessionId });
      } else {
        console.log('No session created');
      }
    } catch (err) {
      console.error('Full OAuth error:', JSON.stringify(err, null, 5));
    }
  }, [startGoogleFlow]);
  return (
    <Pressable onPress={onSignInWithGoogle} className="w-full">
      <HStack className="px-3 py-2 bg-white rounded-lg items-center w-full gap-2.5">
        <Ionicons name="logo-google" color="black" size={24} />
        <Text>Login with Google</Text>
      </HStack>
    </Pressable>
  );
};

I am using expo version 51.

I checked my clerk_publishable_keys to see if they are loaded in the clerk provider and they are loading just fine. It was working a week or so prior but suddenly it stopped working.

Upvotes: 1

Views: 42

Answers (0)

Related Questions