deviantdev
02/15/2024, 7:45 AMrp_st
02/15/2024, 8:14 AMdeviantdev
02/15/2024, 8:14 AMdeviantdev
02/15/2024, 8:14 AMdeviantdev
02/15/2024, 8:19 AMdeviantdev
02/15/2024, 8:19 AMdeviantdev
02/15/2024, 8:19 AMdeviantdev
02/15/2024, 8:19 AMdeviantdev
02/15/2024, 8:20 AMrp_st
02/15/2024, 8:21 AMdeviantdev
02/15/2024, 8:22 AMdeviantdev
02/15/2024, 8:22 AMrp_st
02/15/2024, 8:23 AMrp_st
02/15/2024, 8:23 AMdeviantdev
02/15/2024, 8:23 AMdeviantdev
02/15/2024, 8:23 AMrp_st
02/15/2024, 8:23 AMdeviantdev
02/15/2024, 8:24 AMrp_st
02/15/2024, 8:24 AMrp_st
02/15/2024, 8:24 AMrp_st
02/15/2024, 8:24 AMdeviantdev
02/15/2024, 8:25 AMdeviantdev
02/15/2024, 8:25 AMdeviantdev
02/15/2024, 8:26 AMdeviantdev
02/15/2024, 8:27 AMsupertokens.init(backendConfig());
const port = process.env.APP_PORT || 3000;
const apiBasePath = "/api/auth/";
export const websiteDomain = process.env.APP_URL || process.env.NEXT_PUBLIC_APP_URL || `http://localhost:${port}`;
export const appInfo = {
appName: "SuperTokens Demo App",
websiteDomain,
apiDomain: websiteDomain,
apiBasePath,
};
import ThirdPartyEmailPasswordNode from "supertokens-node/recipe/thirdpartyemailpassword";
import SessionNode from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";
import { AuthConfig } from "../interfaces";
export let backendConfig = (): AuthConfig => {
return {
framework: "express",
debug: true,
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "http://192.168.0.80:3567",
},
appInfo,
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
ThirdPartyEmailPasswordNode.init({
providers: [
// We have provided you with development keys which you can use for testing.
// IMPORTANT: Please replace them with your own OAuth keys for production use.
{
config: {
thirdPartyId: "google",
clients: [
{
clientId:
"1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
clientSecret: "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",
},
],
},
},
{
config: {
thirdPartyId: "github",
clients: [
{
clientId: "467101b197249757c71f",
clientSecret: "e97051221f4b6426e8fe8d51486396703012f5bd",
},
],
},
},
{
config: {
thirdPartyId: "apple",
clients: [
{
clientId: "4398792-io.supertokens.example.service",
additionalConfig: {
keyId: "7M48Y4RYDL",
privateKey:
"-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
teamId: "YWQCXGJRJL",
},
},
],
},
},
{
config: {
thirdPartyId: "twitter",
clients: [
{
clientId: "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
clientSecret:
"BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC",
},
],
},
},
],
}),
Dashboard.init(),
SessionNode.init(),
UserRoles.init(),
],
isInServerlessEnv: true,
};
};
deviantdev
02/15/2024, 8:31 AMversion: '3'
services:
# Note: If you are assigning a custom name to your db service on the line below, make sure it does not contain underscores
db:
image: 'postgres:latest'
environment:
POSTGRES_USER: supertokens_user
POSTGRES_PASSWORD: somePassword
POSTGRES_DB: supertokens
ports:
- 5432:5432
networks:
- app_network
restart: unless-stopped
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'supertokens_user', '-d', 'supertokens']
interval: 5s
timeout: 5s
retries: 5
supertokens:
image: registry.supertokens.io/supertokens/supertokens-postgresql:7.0
depends_on:
db:
condition: service_healthy
ports:
- 3567:3567
environment:
POSTGRESQL_CONNECTION_URI: "postgresql://supertokens_user:somePassword@db:5432/supertokens"
networks:
- app_network
restart: unless-stopped
healthcheck:
test: >
bash -c 'exec 3<>/dev/tcp/127.0.0.1/3567 && echo -e "GET /hello HTTP/1.1\r\nhost: 127.0.0.1:3567\r\nConnection: close\r\n\r\n" >&3 && cat <&3 | grep "Hello"'
interval: 10s
timeout: 5s
retries: 5
networks:
app_network:
driver: bridge
deviantdev
02/15/2024, 8:31 AMdeviantdev
02/15/2024, 8:33 AMdeviantdev
02/15/2024, 8:33 AMdeviantdev
02/15/2024, 8:34 AMhttp://localhost:3000/api/auth/dashboard
deviantdev
02/15/2024, 8:34 AMhttp://192.168.0.80:3567/api/auth/dashboard
deviantdev
02/15/2024, 8:36 AMrp_st
02/15/2024, 8:51 AMdeviantdev
02/15/2024, 8:56 AM