# Google oauth2 login with python package encountered weird error

**URL:** <https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913>\
**Category:** Get Help\
**Tags:** google-social-connection, connections\
**Created:** [January 11, 2023, 8:22am UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913 "2023-01-11T08:22:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![david34](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david34/32/42422_2.png) [@david34](https://community.auth0.com/u/david34)\
**Post date:** [January 11, 2023, 8:22am UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/1 "2023-01-11T08:22:11Z")

</div>

Hi all,  
I’m using python fastapi as the backend of my mobile app but when I tried to implement `google-oauth2` login method with python package it returned a weird message where I can’t find any other posts on the internet with similar issue. The error message reads: `a0.sdk.internal.unknown`

Any help is appreciated!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 20, 2023, 8:32pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/3 "2023-01-20T20:32:07Z")

</div>

Hi @david34,

Welcome to the Auth0 Community!

Hm, I’m not familiar with that error either. Can you provide some more context? Is there a more detailed message? Also, what code is causing this error? Can you share info about which SDK, version, etc.?

---

<div class="post-metadata">

**Author:** ![david34](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david34/32/42422_2.png) [@david34](https://community.auth0.com/u/david34)\
**Post date:** [January 26, 2023, 7:17pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/5 "2023-01-26T19:17:45Z")

</div>

Hi Dan,

Thank you for the reply. We using FastAPI (python) as our backend and the frontend will communicate with google and send back the token once they are authorized. We are currently using python auth0 package to handle the social login right now but after passing in the required variable the endpoint will return with the error stated above. did you have any clue where I should start in terms of fixing this error? Thanks!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 27, 2023, 2:46pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/6 "2023-01-27T14:46:32Z")

</div>

Yes, please share the SDK name, version, and code you are using.

---

<div class="post-metadata">

**Author:** ![david34](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david34/32/42422_2.png) [@david34](https://community.auth0.com/u/david34)\
**Post date:** [January 30, 2023, 7:16pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/7 "2023-01-30T19:16:46Z")

</div>

Hi,  
Thanks for the response. We are using auth0-python==3.23.1 and the code we are using is

```auto
from auth0.v3.authentication import Social
social = Social(account_url)
social.login(client_id=client_id, access_token=token_returned_by_frontend_signin, connection='google-oauth2')

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 30, 2023, 9:31pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/8 "2023-01-30T21:31:40Z")

</div>

Are you just trying to validate the token here?

---

<div class="post-metadata">

**Author:** ![david34](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david34/32/42422_2.png) [@david34](https://community.auth0.com/u/david34)\
**Post date:** [January 30, 2023, 9:57pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/9 "2023-01-30T21:57:26Z")

</div>

I’m trying to do a social login, but looks like it’s not how it works?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 30, 2023, 9:59pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/10 "2023-01-30T21:59:18Z")

</div>

Is your fastapi app functioning as a rest API? Usually you just pass it a bearer token and that grants/forbids access to resources.

---

<div class="post-metadata">

**Author:** ![david34](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david34/32/42422_2.png) [@david34](https://community.auth0.com/u/david34)\
**Post date:** [January 30, 2023, 10:32pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/11 "2023-01-30T22:32:36Z")

</div>

yes I understand that. Our frontend is authenticating with google service and that returns a token and we pass that token to auth0 to achieve social login ( registration ) with auth0. we’re just not sure if that’s how it should work.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 31, 2023, 2:24pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/12 "2023-01-31T14:24:46Z")

</div>

To confirm, you are authenticating directly with Google in your mobile app, then sending the returned Google Access Token to Auth0?

Are you following a tutorial or doc that is suggesting this flow? I’m a little confused about your setup.

---

<div class="post-metadata">

**Author:** ![david34](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david34/32/42422_2.png) [@david34](https://community.auth0.com/u/david34)\
**Post date:** [February 1, 2023, 3:39pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/13 "2023-02-01T15:39:47Z")

</div>

So our frontend app would authenticate with google endpoint and get the token back from google and pass that token into the python sdk. Is that not how we should be doing this? I didn’t really find any documentation on how I should be using the social login feature with the python sdk. Would you mind pointing me to that? Really appreciate it!

---

<div class="post-metadata">

**Author:** ![MambaEric](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mambaeric/32/44230_2.png) [@MambaEric](https://community.auth0.com/u/MambaEric)\
**Post date:** [February 1, 2023, 3:51pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/14 "2023-02-01T15:51:27Z")

</div>

Hi! I’m the frontend developer working on the app. We are using [Expo’s AuthSession sdk](https://docs.expo.dev/versions/latest/sdk/auth-session/) and we’re using it this way:

```auto
import { AuthSessionResult } from "expo-auth-session";
import { useAuthRequest } from "expo-auth-session/providers/google";
import { useCallback, useEffect } from "react";
import { StyleProp, ViewStyle } from "react-native";
import { useDispatch } from "../store";
import { googleSignInThunk, getUserThunk } from "../store/actions/userActions";
import { fireHaptics } from "../utils/haptics";
import { Button } from "./Button";

interface Props {
  style?: StyleProp<ViewStyle>;
}

export const GoogleSignInButton = ({ style }: Props) => {
  const dispatch = useDispatch();
  const [request, response, promptAsync] = useAuthRequest({
    expoClientId:
      "455074804612-u81glfa835g8mn47q468j310iofj2iq9.apps.googleusercontent.com",
    webClientId:
      "455074804612-u81glfa835g8mn47q468j310iofj2iq9.apps.googleusercontent.com",
    iosClientId:
      "378340700762-hb92q9qd6v0amp5rf4e90gqceherb493.apps.googleusercontent.com",
    scopes: ["email"],
  });
  const startSignIn = useCallback(async () => {
    try {
      if (!request) return;
      console.log("sign in");
      await promptAsync();
    } catch (e) {
      console.log(e);
      if ((e as { code: string }).code === "ERR_CANCELED") return;
      else {
        // handle other errors
      }
    }
  }, [dispatch, request]);
  const handleSignIn = async (response: AuthSessionResult) => {
    console.log(response);
    if (response.type !== "success") return;
    if (
      (await dispatch(googleSignInThunk(response))).meta.requestStatus ===
      "rejected"
    ) {
      fireHaptics("error");
      return;
    }
    if (
      (await dispatch(getUserThunk(true))).meta.requestStatus === "rejected"
    ) {
      fireHaptics("error");
      return;
    }
  };
  useEffect(() => {
    if (!response) return;
    handleSignIn(response);
  }, [response]);
  return (
    <Button
      style={style}
      onPress={startSignIn}
      title="Google Sign In"
      buttonStyleKey="unfilled"
    />
  );
};

```

---

<div class="post-metadata">

**Author:** ![MambaEric](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mambaeric/32/44230_2.png) [@MambaEric](https://community.auth0.com/u/MambaEric)\
**Post date:** [February 1, 2023, 3:52pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/15 "2023-02-01T15:52:37Z")

</div>

`googleSignInThunk` basically fires off an api call to our server with what is returned from the response of the user signing in on google.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 2, 2023, 2:16pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/16 "2023-02-02T14:16:28Z")

</div>

Hi @MambaEric,

Welcome to the Auth0 Community!

Why aren’t you authenticating with Auth0 in your frontend? You should be able to provide the same UX, but retrieve Auth0 Access Tokens in your front end and start a session. This would be the most common setup.

* * *

@david34

> [@david34](#):
>
> I didn’t really find any documentation on how I should be using the social login feature with the python sdk. Would you mind pointing me to that? Really appreciate it!

I’m actually not familiar with using the SDK like that. This isn’t a flow I’ve seen used before (that is; authenticating directly with the IdP then passing the IdP Access Token to Auth0), but I reach out to the owners of that library and discuss.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 2, 2023, 2:26pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/17 "2023-02-02T14:26:08Z")

</div>

Update: I found it, it’s a legacy flow.

[https://auth0.com/docs/api/authentication#login15](https://auth0.com/docs/api/authentication#login15)

---

<div class="post-metadata">

**Author:** ![MambaEric](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mambaeric/32/44230_2.png) [@MambaEric](https://community.auth0.com/u/MambaEric)\
**Post date:** [February 4, 2023, 6:19am UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/18 "2023-02-04T06:19:32Z")

</div>

Since there are several versions of documentation up, what is the correct way a react-native app built with expo and a python background should interface with Auth0? Ideally, the user does not have to go to a webview within the app

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 6, 2023, 2:24pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/19 "2023-02-06T14:24:35Z")

</div>

@MambaEric,

Have you had the chance to look at our [quickstarts](https://auth0.com/docs/quickstarts/) that demo the frameworks you listed?

> [@MambaEric](#):
>
> Ideally, the user does not have to go to a webview within the app

Auth0 offers both options. Have you seen this doc? [Auth0 Native/Mobile App Quickstarts](https://auth0.com/docs/microsites/add-login/add-login-native-mobile-app)

I would highly suggest taking a moment to read through our docs before implementing anything. This page is a good place to begin: [Get Started](https://auth0.com/docs/get-started)

---

<div class="post-metadata">

**Author:** ![MambaEric](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mambaeric/32/44230_2.png) [@MambaEric](https://community.auth0.com/u/MambaEric)\
**Post date:** [February 21, 2023, 10:09pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/20 "2023-02-21T22:09:44Z")

</div>

I don’t see a guide for the embedded solution for react-native, only iOS and Android native. Could you please point me to the appropriate documentation? I found this: [Auth0 Expo SDK Quickstarts: Login](https://auth0.com/docs/quickstart/native/react-native-expo/00-login) but pretty sure it opens the auth0 login page (instead of going directly to googles login page).

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 22, 2023, 1:51pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/21 "2023-02-22T13:51:54Z")

</div>

@MambaEric,

It doesn’t look like we have an recent example of embedded login with React Native. We don’t recommend using embedded login flows, and this is likely why it doesn’t exist.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 24, 2023, 7:15pm UTC](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913/22 "2023-02-24T19:15:11Z")

</div>

A follow up on this; you can pass a `connection` param with your request to `/authorize` to redirect directly to the identity provider (in this case google). That would bypass the Auth0 login page.

[Next page](https://community.auth0.com/t/google-oauth2-login-with-python-package-encountered-weird-error/97913.md?page=2)
