Built in providers
#
Setup#
Step 1: Front EndSuperTokens currently supports the following providers, but you can also add your own:
- Github
- Apple
- BitBucket
- GitLab (Single tenant)
- ReactJS
- Angular
- Vue
- Plain JavaScript
- React Native
Note
You can use the
You can refer to this example app as a reference for using the
supertokens-web-js
SDK which exposes several helper functions that query the APIs exposed by the SuperTokens backend SDK.You can refer to this example app as a reference for using the
supertokens-web-js
SDK.Note
To use SuperTokens with React Native you need to use the
To add login functionality, you need to build your own UI and call the APIs exposed by the backend SDKs. You can find the API spec here
supertokens-react-native
SDK. The SDK provides session management features.To add login functionality, you need to build your own UI and call the APIs exposed by the backend SDKs. You can find the API spec here
What type of UI are you using?
Prebuilt UICustom UI
What type of UI are you using?
Prebuilt UICustom UI
import SuperTokens from "supertokens-auth-react";
import ThirdPartyEmailPassword, {Google, Github, Facebook, Apple} from "supertokens-auth-react/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
recipeList: [
ThirdPartyEmailPassword.init({
signInAndUpFeature: {
providers: [
Github.init(),
Google.init(),
Facebook.init(),
Apple.init(),
],
// ...
},
// ...
}),
// ...
]
});
#
Step 2: Back End- NodeJS
- GoLang
- Python
- Other Frameworks
Important
For other backend frameworks, you can follow our guide on how to spin up a separate server configured with the SuperTokens backend SDK to authenticate requests and issue session tokens.
import SuperTokens from "supertokens-node";
import Session from "supertokens-node/recipe/session";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
let { Google, Github, Facebook, Apple } = ThirdPartyEmailPassword;
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
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
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdparty"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.TypeProvider{
thirdparty.Google(tpmodels.GoogleConfig{
ClientID: "TODO: GOOGLE_CLIENT_ID",
ClientSecret: "TODO: GOOGLE_CLIENT_SECRET",
}),
thirdparty.Github(tpmodels.GithubConfig{
ClientID: "TODO: GITHUB_CLIENT_ID",
ClientSecret: "TODO: GITHUB_CLIENT_SECRET",
}),
thirdparty.Facebook(tpmodels.FacebookConfig{
ClientID: "TODO: FACEBOOK_CLIENT_ID",
ClientSecret: "TODO: FACEBOOK_CLIENT_SECRET",
}),
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdpartyemailpassword import Github, Google, Facebook, Apple
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
Google(
client_id='GOOGLE_CLIENT_ID',
client_secret='GOOGLE_CLIENT_SECRET'
), Facebook(
client_id='FACEBOOK_CLIENT_ID',
client_secret='FACEBOOK_CLIENT_SECRET'
), Github(
client_id='GITHUB_CLIENT_ID',
client_secret='GITHUB_CLIENT_SECRET'
),
Apple(
client_id="APPLE_CLIENT_ID",
client_key_id="KEY_ID",
client_private_key="APPLE_PRIVATE_KEY",
client_team_id="APPLE_TEAM_ID"
)
]
)
]
)
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
#
Changing the button styleOn the frontend, you can provide a button component to the in built providers defining your own UI
- ReactJS
- Angular
- Vue
- Plain JavaScript
- React Native
Note
You can use the
You can refer to this example app as a reference for using the
supertokens-web-js
SDK which exposes several helper functions that query the APIs exposed by the SuperTokens backend SDK.You can refer to this example app as a reference for using the
supertokens-web-js
SDK.Note
To use SuperTokens with React Native you need to use the
To add login functionality, you need to build your own UI and call the APIs exposed by the backend SDKs. You can find the API spec here
supertokens-react-native
SDK. The SDK provides session management features.To add login functionality, you need to build your own UI and call the APIs exposed by the backend SDKs. You can find the API spec here
What type of UI are you using?
Prebuilt UICustom UI
What type of UI are you using?
Prebuilt UICustom UI
import SuperTokens from "supertokens-auth-react";
import ThirdPartyEmailPassword, {Google, Github, Facebook, Apple} from "supertokens-auth-react/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
recipeList: [
ThirdPartyEmailPassword.init({
signInAndUpFeature: {
providers: [
Github.init({
buttonComponent: <div></div>
}),
Google.init({
buttonComponent: <div></div>
}),
Facebook.init({
buttonComponent: <div></div>
}),
Apple.init({
buttonComponent: <div></div>
}),
],
// ...
},
// ...
}),
// ...
]
});