Skip to main content

Built in providers

Setup#

Step 1: Front End#

Supertokens currently supports the following providers, but you can also add your own:

  • Github
  • Google
  • Facebook
  • Apple
import SuperTokens from "supertokens-auth-react";import ThirdParty, {Google, Github, Facebook, Apple} from "supertokens-auth-react/recipe/thirdparty";SuperTokens.init({    appInfo: {        apiDomain: "...",        appName: "...",        websiteDomain: "..."    },    recipeList: [        ThirdParty.init({            signInAndUpFeature: {                providers: [                    Github.init(),                    Google.init(),                    Facebook.init(),                    Apple.init(),                ],                // ...            },            // ...        }),        // ...    ]});

Step 2: Back End#

import SuperTokens from "supertokens-node";import Session from "supertokens-node/recipe/session";import EmailPassword from "supertokens-node/recipe/emailpassword";import ThirdParty from "supertokens-node/recipe/thirdparty";let { Google, Github, Facebook, Apple } = ThirdParty
SuperTokens.init({    appInfo: {        apiDomain: "...",        appName: "...",        websiteDomain: "..."    },    supertokens: {        connectionURI: "...",    },    recipeList: [        ThirdParty.init({            signInAndUpFeature: {                providers: [                    Google({                        clientSecret: "TODO: GOOGLE_CLIENT_SECRET",                        clientId: "TODO: GOOGLE_CLIENT_ID"                    }),                    Github({                        clientSecret: "TODO: GITHUB_CLIENT_SECRET",                        clientId: "TODO: GITHUB_CLIENT_ID"                    }),                    Facebook({                        clientSecret: "TODO: FACEBOOK_CLIENT_SECRET",                        clientId: "TODO: FACEBOOK_CLIENT_ID"                    }),                    Apple({                        clientSecret: {                            teamId: "APPLE_TEAM_ID",                            privateKey: "APPLE_PRIVATE_KEY",                            keyId: "KEY_ID"                        },                        clientId: "APPLE_CLIENT_ID"                    })                ]            }        }), // initializes signin / sign up features         Session.init() // initializes session features    ]});
Security

Make sure that the above configurations for "CLIENT_SECRET" are stored in your environment variables and not directly in your source code files.

Get the Third Party Provider's Access Token:#

See this section