Hi I am trying Supertokens social login using Fast...
# general
a
Hi I am trying Supertokens social login using Fast API and custom UI. Everytime I am trying to get an access token, I am getting an error in
singinup
API.
{"status":"FIELD_ERROR","error":"'access_token'"}
r
Hey! Which social login provider are you using? And what’s the input to the signinup API?
a
I am using Google. Below is the request:
{"code":"XXXXXXX13mNOcETHEeeI43Entk2ZXXXXXXXXXX","redirectURI":"http://localhost:3000/auth/callback/google","thirdPartyId":"google"}
r
Hmm. That does seem about right. Can you open an issue about this on our GitHub?
a
Sure
r
Can I see the config you have provided for google in supertokens.init?
@Ashish
a
Sure
Copy code
init(
    supertokens_config=SupertokensConfig(
        connection_uri="https://dbd187XXXXXXXX-ap-southeast-1.aws.supertokens.io:3571",
        api_key="XXXXXXXXX"
    ),
    app_info=InputAppInfo(
        app_name='Supertokens',
        api_domain='http://localhost:' + get_api_port(),
        website_domain=get_website_domain()
    ),
    framework='fastapi',
    recipe_list=[
        session.init(),
        thirdpartyemailpassword.init(
            providers=[
                Google(
                    is_default=True,
                    client_id='22222222-XXXXXXX.apps.googleusercontent.com',  # type: ignore
                    client_secret='GOCSPX-XXXXXXXXX'  # type: ignore
                ),
            ]
        )
    ],
    telemetry=False
)
r
Hmm. This seems about right. Ok. We will try and investigate the error on the SDK side
a
It was working fine till yday evening though
r
Ohhh. Hmm. That’s really strange then
Did you change anything since yest?
a
Also, I was working on Linkedin as a custom provider yday. Looks like Linkedin accepts encoded forms to get access token, unlike params (json)
No
r
Ok thanks. So the example app has the same issue?
a
I mean I tried my own app, I was getting the same issue. Then tried this example app, but no success.
r
Got it. Thanks. Will investigate it
Let me check for LinkedIn
a
Sure
This is a sample cURL for Linkedin that worked for getting access token:
Copy code
curl --location --request POST 'https://www.linkedin.com/oauth/v2/accessToken' \
--data-urlencode 'client_id=XXXXXX' \
--data-urlencode 'client_secret=XXXXXX' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'code=XXXXXXXXXX' \
--data-urlencode 'redirect_uri=http://localhost:3000/login'
r
The way you can support LinkedIn then is to override the signinupPOST api implementation, copy the code from the SDK into your override function and then make the call using x-www-form-urlencoded yourself.
a
Yeah, let me try that
r
Lmk if you run into issues during that
a
Sure
k
Hey @Ashish this error should happen only when https://github.com/supertokens/supertokens-python/blob/master/supertokens_python/recipe/thirdparty/api/implementation.py#L111 returns an invalid response. (i.e. the response doesn't include an "access_token" field which is required for the upcoming steps) Can you please cross-check your client id, client secret, code, and redirect URI once?
Hey @Ashish could you try this? ^
66 Views