<@498057949541826571> I have this peace of code a...
# support-questions-legacy
p
@rp_st I have this peace of code and i want to use thirdparty provider
Copy code
ThirdPartyEmailPassword.init({
        providers: [
          {
            config: {
              thirdPartyId: "google",
              clients: [
                {
                  clientId: config.google.auth_client_id,
                  clientSecret: config.google.auth_client_secret,
                },
              ],
            },
            isDefault: true,
          },
          {
            config: {
              thirdPartyId: "clever",
              clients: [
                {
                  clientId: "CLIENT_ID",
                  clientSecret: "CLIENT_SECRET",
                },
              ],
            },
          },
        ],})
It says The third party provider google seems to be missing from the backend configs supertokens. Can you help what I am doing wrong ?
r
hey @showtim33 which backend sdk version are you using?
p
@rp_st 12.1.4 this one
r
Right. This is an older version of the backend SDK
Checkout the older version docs button on the right of our doc’s page.
You can view older versions of our docs that way. Which are for the SDK version that you have
p
@rp_st Thanks that was great help. We progressed. But i have a situation here again. Currently we are able to redirect to third party provider login page. And once logged into the thirdparty provider it provides us the redirect uri like this http://auth.example.tt/auth/callback/thirdparty?code=b469a3d59a1360ee2297&state=21b54a710dc41f38d05b0 Here in this url we can see the params code. When we do post request to the thirdparty with the code then only it provides the token. And with the gained token we can get the user details. But in super tokens we have code something like this
Copy code
{
                    id: "custom",
                    get: (redirectURI, authCodeFromRequest) => {
                        return {
                            accessTokenAPI: {
                                url: "https://oauth.example.com/token",
                                params: {
                                    client_id: "<CLIENT ID>",
                                    client_secret: "<CLIENT SECRET>",
                                    grant_type: "authorization_code",
                                    redirect_uri: redirectURI || "",
                                    code: authCodeFromRequest || "",
                                }
                            }.....,
                        }
                    }
                }
Now my question here is do we have send request from our app to thirdparty provider with the above url to get the token or the we are doing something wrong with custom provider so that api will do these stuff on it's own without app sending request to thirdparty provider. I meant accessTokenAPI this does the exact thing right ?.
r
no the callack page, you have to make a request to the signinup API which does the token exchange automatically based on the url you provide in the
accessTokenAPI
object
i don't quite understand your question
p
@rp_st sorry for the confusion I have this on the app side requesting on api
Copy code
const thirdpartysignIn = async (redirectURL: string) => {
  const authUrl = await getAuthorisationURLWithQueryParamsAndSetState({
    authorisationURL: `${config.authUrl}auth/callback/thirdparty`,
    providerId: "thirdparty",
  });

  window.location.assign(
    `${config.authUrl}redirect/thirdparty?to=${authUrl}?redirect-uri=${redirectURL}`
  );
};
and api redirects me to login page of the thirdparty and when logged in it redirects me here http://auth.example.tt/auth/callback/thirdparty?code=b469a3d59a1360ee2297&state=21b54a710dc41f38d05b0 Instead of giving me the user info as google does.
r
this is correct. On this page, you need to call the signinup API, just like our docs say
p
@rp_st can you please help me with the docs. Also route that i should call in api ?
3 Views