diff --git a/examples/with-aws-lambda/.gitignore b/examples/with-aws-lambda/.gitignore deleted file mode 100644 index 93872bd5b..000000000 --- a/examples/with-aws-lambda/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -node_modules -.pnp -.pnp.js - -# testing -coverage - -# production -build - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local -.eslintcache -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/examples/with-aws-lambda/backend/config.mjs b/examples/with-aws-lambda/backend/config.mjs deleted file mode 100644 index 52e5cda51..000000000 --- a/examples/with-aws-lambda/backend/config.mjs +++ /dev/null @@ -1,70 +0,0 @@ -import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword"; -import Session from "supertokens-node/recipe/session"; - -export function getBackendConfig() { - return { - framework: "awsLambda", - supertokens: { - connectionURI: "", - apiKey: "", - }, - appInfo: { - // learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo - appName: "^{form_appName}", - apiDomain: "^{form_apiDomain}", - websiteDomain: "^{form_websiteDomain}", - apiBasePath: "^{form_apiBasePath}", - websiteBasePath: "^{form_websiteBasePath}", - apiGatewayPath: "/dev", - }, - recipeList: [ - ThirdPartyEmailPassword.init({ - // 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. - providers: [ - { - 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", - }, - }, - ], - }, - }, - ], - }), - Session.init(), - ], - isInServerlessEnv: true, - }; -} diff --git a/examples/with-aws-lambda/backend/index.mjs b/examples/with-aws-lambda/backend/index.mjs deleted file mode 100644 index 86806fb4c..000000000 --- a/examples/with-aws-lambda/backend/index.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import supertokens from "supertokens-node"; -import { middleware } from "supertokens-node/framework/awsLambda"; -import { getBackendConfig } from "./config.mjs"; -import middy from "@middy/core"; -import cors from "@middy/http-cors"; -import { handler as userHandler } from "./user.mjs"; - -supertokens.init(getBackendConfig()); - -export const handler = middy( - middleware((event) => { - if (event.path === "/user") { - return userHandler(event); - } - - return { - body: JSON.stringify({ - msg: "Hello!", - }), - statusCode: 200, - }; - }) -) - .use( - cors({ - origin: getBackendConfig().appInfo.websiteDomain, - credentials: true, - headers: ["Content-Type", ...supertokens.getAllCORSHeaders()].join(", "), - methods: "OPTIONS,POST,GET,PUT,DELETE", - }) - ) - .onError((request) => { - throw request.error; - }); diff --git a/examples/with-aws-lambda/backend/package.json b/examples/with-aws-lambda/backend/package.json deleted file mode 100644 index 46d5fc013..000000000 --- a/examples/with-aws-lambda/backend/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "aws-lambda-test", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "@middy/core": "^5.1.0", - "@middy/http-cors": "^5.1.0", - "supertokens-node": "latest" - } -} diff --git a/examples/with-aws-lambda/backend/user.mjs b/examples/with-aws-lambda/backend/user.mjs deleted file mode 100644 index d423038ec..000000000 --- a/examples/with-aws-lambda/backend/user.mjs +++ /dev/null @@ -1,34 +0,0 @@ -let supertokens = require("supertokens-node"); -let { verifySession } = require("supertokens-node/recipe/session/framework/awsLambda"); -let middy = require("@middy/core"); -let cors = require("@middy/http-cors"); -let { getBackendConfig } = require("./config.mjs"); - -supertokens.init(getBackendConfig()); - -const userHandler = async (event, _) => { - return { - statusCode: 200, - headers: { - "content-type": "application/json", - }, - body: JSON.stringify({ - sessionHandle: event.session.getHandle(), - userId: event.session.getUserId(), - accessTokenPayload: event.session.getAccessTokenPayload(), - }), - }; -}; - -export const handler = middy(verifySession(userHandler)) - .use( - cors({ - origin: getBackendConfig().appInfo.websiteDomain, - credentials: true, - headers: ["Content-Type", ...supertokens.getAllCORSHeaders()].join(", "), - methods: "OPTIONS,POST,GET,PUT,DELETE", - }) - ) - .onError((request) => { - throw request.error; - }); diff --git a/examples/with-aws-lambda/frontend/.env b/examples/with-aws-lambda/frontend/.env deleted file mode 100644 index 7d910f148..000000000 --- a/examples/with-aws-lambda/frontend/.env +++ /dev/null @@ -1 +0,0 @@ -SKIP_PREFLIGHT_CHECK=true \ No newline at end of file diff --git a/examples/with-aws-lambda/frontend/package.json b/examples/with-aws-lambda/frontend/package.json deleted file mode 100644 index 7a6ed4b4f..000000000 --- a/examples/with-aws-lambda/frontend/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "frontend", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "start": "BROWSER=none PORT=8888 react-scripts start" - }, - "author": "", - "license": "ISC", - "dependencies": { - "@testing-library/jest-dom": "^5.11.4", - "@testing-library/react": "^11.1.0", - "@testing-library/user-event": "^12.1.10", - "@types/jest": "^26.0.15", - "@types/node": "^12.0.0", - "@types/react": "^16.9.53", - "@types/react-dom": "^16.9.8", - "axios": "^0.21.1", - "body-parser": "^1.19.0", - "npm-run-all": "^4.1.5", - "react": "^18.0.0", - "react-dom": "^18.0.0", - "react-router-dom": "^6.2.1", - "react-scripts": "^5.0.1", - "supertokens-auth-react": "latest", - "typescript": "^4.0.3", - "web-vitals": "^0.2.4" - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - } -} diff --git a/examples/with-aws-lambda/frontend/public/_redirects b/examples/with-aws-lambda/frontend/public/_redirects deleted file mode 100644 index 78f7f2067..000000000 --- a/examples/with-aws-lambda/frontend/public/_redirects +++ /dev/null @@ -1 +0,0 @@ -/* /index.html 200 \ No newline at end of file diff --git a/examples/with-aws-lambda/frontend/public/background.svg b/examples/with-aws-lambda/frontend/public/background.svg deleted file mode 100644 index a0309e655..000000000 --- a/examples/with-aws-lambda/frontend/public/background.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/examples/with-aws-lambda/frontend/public/favicon.ico b/examples/with-aws-lambda/frontend/public/favicon.ico deleted file mode 100644 index a11777cc4..000000000 Binary files a/examples/with-aws-lambda/frontend/public/favicon.ico and /dev/null differ diff --git a/examples/with-aws-lambda/frontend/public/index.html b/examples/with-aws-lambda/frontend/public/index.html deleted file mode 100644 index 7e63e6f25..000000000 --- a/examples/with-aws-lambda/frontend/public/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - React App - - - -
- - diff --git a/examples/with-aws-lambda/frontend/public/logo192.png b/examples/with-aws-lambda/frontend/public/logo192.png deleted file mode 100644 index fc44b0a37..000000000 Binary files a/examples/with-aws-lambda/frontend/public/logo192.png and /dev/null differ diff --git a/examples/with-aws-lambda/frontend/public/logo512.png b/examples/with-aws-lambda/frontend/public/logo512.png deleted file mode 100644 index a4e47a654..000000000 Binary files a/examples/with-aws-lambda/frontend/public/logo512.png and /dev/null differ diff --git a/examples/with-aws-lambda/frontend/public/manifest.json b/examples/with-aws-lambda/frontend/public/manifest.json deleted file mode 100644 index f01493ff0..000000000 --- a/examples/with-aws-lambda/frontend/public/manifest.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "short_name": "React App", - "name": "Create React App Sample", - "icons": [ - { - "src": "favicon.ico", - "sizes": "64x64 32x32 24x24 16x16", - "type": "image/x-icon" - }, - { - "src": "logo192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "logo512.png", - "type": "image/png", - "sizes": "512x512" - } - ], - "start_url": ".", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/examples/with-aws-lambda/frontend/public/robots.txt b/examples/with-aws-lambda/frontend/public/robots.txt deleted file mode 100644 index e9e57dc4d..000000000 --- a/examples/with-aws-lambda/frontend/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: diff --git a/examples/with-aws-lambda/frontend/src/App.css b/examples/with-aws-lambda/frontend/src/App.css deleted file mode 100644 index abce9ccf8..000000000 --- a/examples/with-aws-lambda/frontend/src/App.css +++ /dev/null @@ -1,33 +0,0 @@ -.App { - display: flex; - flex-direction: column; - justify-content: stretch; - width: 100vw; - height: 100vh; - font-family: Rubik; -} - -.fill { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - flex: 1 1 auto; -} - -.footer { - align-self: "flex-end"; -} - -.sessionButton { - padding-left: 13px; - padding-right: 13px; - padding-top: 8px; - padding-bottom: 8px; - background-color: black; - border-radius: 10px; - cursor: pointer; - color: white; - font-weight: bold; - font-size: 17px; -} diff --git a/examples/with-aws-lambda/frontend/src/App.test.tsx b/examples/with-aws-lambda/frontend/src/App.test.tsx deleted file mode 100644 index 9b2f4d07b..000000000 --- a/examples/with-aws-lambda/frontend/src/App.test.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from "react"; -import { render, screen } from "@testing-library/react"; -import App from "./App"; - -test("renders learn react link", () => { - render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/examples/with-aws-lambda/frontend/src/App.tsx b/examples/with-aws-lambda/frontend/src/App.tsx deleted file mode 100644 index 67463f65a..000000000 --- a/examples/with-aws-lambda/frontend/src/App.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import "./App.css"; -import SuperTokens, { SuperTokensWrapper } from "supertokens-auth-react"; -import { getSuperTokensRoutesForReactRouterDom } from "supertokens-auth-react/ui"; -import ThirdPartyEmailPassword from "supertokens-auth-react/recipe/thirdpartyemailpassword"; -import { ThirdPartyEmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/thirdpartyemailpassword/prebuiltui"; -import Session, { SessionAuth } from "supertokens-auth-react/recipe/session"; -import Home from "./Home"; -import { Routes, BrowserRouter as Router, Route } from "react-router-dom"; -import Footer from "./Footer"; - -export function getDomain() { - let host = window.location.hostname; - let port = window.location.port; - if (port !== "0" && port !== "80" && port !== "443" && port !== "") { - return host + ":" + port; - } - return host; -} -export function getAPIDomain() { - return ""; -} - -SuperTokens.init({ - appInfo: { - appName: "SuperTokens Demo App", - apiDomain: getAPIDomain(), - websiteDomain: getDomain(), - apiBasePath: "/auth", - apiGatewayPath: "/dev", - }, - recipeList: [ - ThirdPartyEmailPassword.init({ - signInAndUpFeature: { - providers: [ - ThirdPartyEmailPassword.Google.init(), - ThirdPartyEmailPassword.Github.init(), - ThirdPartyEmailPassword.Apple.init(), - ], - }, - }), - Session.init(), - ], -}); - -function App() { - return ( - - -
-
- - {getSuperTokensRoutesForReactRouterDom(require("react-router-dom"), [ - ThirdPartyEmailPasswordPreBuiltUI, - ])} - - - - } - /> - -
-
-
-
-
-
-
- ); -} - -export default App; diff --git a/examples/with-aws-lambda/frontend/src/Footer/index.tsx b/examples/with-aws-lambda/frontend/src/Footer/index.tsx deleted file mode 100644 index 245f4baa4..000000000 --- a/examples/with-aws-lambda/frontend/src/Footer/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -export default function Footer(): JSX.Element { - return ( -
- React Demo app. Made with ❤️ using supertokens.com -
- ); -} diff --git a/examples/with-aws-lambda/frontend/src/Home/CallAPIView.tsx b/examples/with-aws-lambda/frontend/src/Home/CallAPIView.tsx deleted file mode 100644 index 3586ef2e0..000000000 --- a/examples/with-aws-lambda/frontend/src/Home/CallAPIView.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import axios from "axios"; -import { getAPIDomain } from "../App"; - -export default function CallAPIView() { - async function callAPIClicked() { - // this will also automatically refresh the session if needed - let response = await axios.get(getAPIDomain() + "/dev/user"); - window.alert("Session Information:\n" + JSON.stringify(response.data, null, 2)); - } - - return ( -
- Call API -
- ); -} diff --git a/examples/with-aws-lambda/frontend/src/Home/Logout.tsx b/examples/with-aws-lambda/frontend/src/Home/Logout.tsx deleted file mode 100644 index 8df3d314e..000000000 --- a/examples/with-aws-lambda/frontend/src/Home/Logout.tsx +++ /dev/null @@ -1,30 +0,0 @@ -export default function Logout({ logoutClicked }: { logoutClicked: () => void }) { - return ( -
-
- SIGN OUT -
-
- ); -} diff --git a/examples/with-aws-lambda/frontend/src/Home/SuccessView.tsx b/examples/with-aws-lambda/frontend/src/Home/SuccessView.tsx deleted file mode 100644 index 2f03173d3..000000000 --- a/examples/with-aws-lambda/frontend/src/Home/SuccessView.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import CallAPIView from "./CallAPIView"; - -export default function SuccessView({ userId }: { userId: string }) { - return ( -
- - 🥳🎉 - - Login successful -
-
- Your user ID is -
- {userId} -
-
-
-
- -
-
-
- ------------------------------------ -
-
-
- - ); -} diff --git a/examples/with-aws-lambda/frontend/src/Home/index.tsx b/examples/with-aws-lambda/frontend/src/Home/index.tsx deleted file mode 100644 index 5777e347d..000000000 --- a/examples/with-aws-lambda/frontend/src/Home/index.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; -import Logout from "./Logout"; -import SuccessView from "./SuccessView"; -import { useSessionContext } from "supertokens-auth-react/recipe/session"; -import { useNavigate } from "react-router-dom"; -import { signOut } from "supertokens-auth-react/recipe/emailpassword"; - -export default function Home() { - const sessionContext = useSessionContext(); - const navigate = useNavigate(); - - async function logoutClicked() { - await signOut(); - navigate("/auth"); - } - - if (sessionContext.loading === true) { - return null; - } - - return ( -
- - -
- ); -} diff --git a/examples/with-aws-lambda/frontend/src/index.css b/examples/with-aws-lambda/frontend/src/index.css deleted file mode 100644 index 04146b5e7..000000000 --- a/examples/with-aws-lambda/frontend/src/index.css +++ /dev/null @@ -1,11 +0,0 @@ -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", - "Droid Sans", "Helvetica Neue", sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; -} diff --git a/examples/with-aws-lambda/frontend/src/index.tsx b/examples/with-aws-lambda/frontend/src/index.tsx deleted file mode 100644 index fbbe35ace..000000000 --- a/examples/with-aws-lambda/frontend/src/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from "react"; -import { createRoot } from "react-dom/client"; -import "./index.css"; -import App from "./App"; -import reportWebVitals from "./reportWebVitals"; - -createRoot(document.getElementById("root")).render( - - - -); - -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/examples/with-aws-lambda/frontend/src/logo.svg b/examples/with-aws-lambda/frontend/src/logo.svg deleted file mode 100644 index 9dfc1c058..000000000 --- a/examples/with-aws-lambda/frontend/src/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/examples/with-aws-lambda/frontend/src/react-app-env.d.ts b/examples/with-aws-lambda/frontend/src/react-app-env.d.ts deleted file mode 100644 index 6431bc5fc..000000000 --- a/examples/with-aws-lambda/frontend/src/react-app-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/with-aws-lambda/frontend/src/reportWebVitals.ts b/examples/with-aws-lambda/frontend/src/reportWebVitals.ts deleted file mode 100644 index 0677b6701..000000000 --- a/examples/with-aws-lambda/frontend/src/reportWebVitals.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ReportHandler } from "web-vitals"; - -const reportWebVitals = (onPerfEntry?: ReportHandler) => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; - -export default reportWebVitals; diff --git a/examples/with-aws-lambda/frontend/src/setupTests.ts b/examples/with-aws-lambda/frontend/src/setupTests.ts deleted file mode 100644 index 1dd407a63..000000000 --- a/examples/with-aws-lambda/frontend/src/setupTests.ts +++ /dev/null @@ -1,5 +0,0 @@ -// jest-dom adds custom jest matchers for asserting on DOM nodes. -// allows you to do things like: -// expect(element).toHaveTextContent(/react/i) -// learn more: https://github.com/testing-library/jest-dom -import "@testing-library/jest-dom"; diff --git a/examples/with-aws-lambda/frontend/tsconfig.json b/examples/with-aws-lambda/frontend/tsconfig.json deleted file mode 100644 index c0555cbc6..000000000 --- a/examples/with-aws-lambda/frontend/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx" - }, - "include": ["src"] -}