Changing OAuth Scopes
If you would like to add additional OAuth Scopes when accessing your third party provider, you can do so by adding them to the config when initializing the backend SDK.
For example if you are using Google as your third party provider, you can add an additional scope as follows:
- NodeJS
- GoLang
- Python
import SuperTokens from "supertokens-node";
import ThirdParty from "supertokens-node/recipe/thirdparty";
SuperTokens.init({
supertokens: {
connectionURI: "...",
},
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
recipeList: [
ThirdParty.init({
signInAndUpFeature: {
providers: [
ThirdParty.Google({
clientSecret: "TODO: GOOGLE_CLIENT_SECRET",
clientId: "TODO: GOOGLE_CLIENT_ID",
scope: [
"additionalFeatureURL",
]
})
]
}
})
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdparty"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdparty.Init(&tpmodels.TypeInput{
SignInAndUpFeature: tpmodels.TypeInputSignInAndUp{
Providers: []tpmodels.TypeProvider{
thirdparty.Google(tpmodels.GoogleConfig{
ClientID: "TODO: GOOGLE_CLIENT_ID",
ClientSecret: "TODO: GOOGLE_CLIENT_SECRET",
Scope: []string{
"scope1", "scope2",
},
}),
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdparty
from supertokens_python.recipe.thirdparty import Google
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdparty.init(
sign_in_and_up_feature=thirdparty.SignInAndUpFeature(providers=[
Google(
client_id=os.environ.get('GOOGLE_CLIENT_ID'),
client_secret=os.environ.get('GOOGLE_CLIENT_SECRET'),
scope=["scope1", "scope2"]
)
])
)
]
)