Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates with-supertokens example app #40707

Merged
merged 142 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
7e044a9
add-supertokens-to-authentication.md
Feb 16, 2021
8e5bd92
Merge branch 'canary' into with-supertokens-example-in-docs
Feb 18, 2021
e290993
bump supertokens deps
kant01ne Feb 18, 2021
0fecb52
update SuperTokens Auth doc
kant01ne Mar 1, 2021
055047b
Merge branch 'canary' into with-supertokens-example-in-docs
Mar 1, 2021
49caedd
Update docs/authentication.md
Mar 1, 2021
a00f6a5
Update docs/authentication.md
Mar 1, 2021
fa05b78
updates supertokens dependency and optimises for serverless execution
rishabhpoddar Apr 6, 2021
0af47ee
updates with original repo
rishabhpoddar Apr 6, 2021
feab6fb
runs prettier-fix
rishabhpoddar Apr 6, 2021
5d8c319
Merge branch 'canary' into canary
rishabhpoddar Apr 6, 2021
7a50823
adds supertokens to 'Bring Your Own Database' section as well
rishabhpoddar Apr 7, 2021
05795a5
Merge branch 'canary' into canary
rishabhpoddar Apr 7, 2021
b44c159
does not show home page if not logged in
rishabhpoddar Apr 8, 2021
ca44249
extracts config into its own file and calls it in all serverless func…
rishabhpoddar Apr 8, 2021
13ad8f2
removes need for backend init in app.jsx
rishabhpoddar Apr 8, 2021
83a8369
simplifies use of dynamic
rishabhpoddar Apr 8, 2021
88f9193
Merge branch 'canary' into canary
rishabhpoddar Apr 8, 2021
39a850e
refreshes page after getServerSideProps
rishabhpoddar Apr 8, 2021
1007e80
removes unnecessary check in API
rishabhpoddar Apr 8, 2021
d0c8a19
Merge branch 'canary' into canary
rishabhpoddar Apr 8, 2021
6f05b35
update to docs pertaining SuperTokens
rishabhpoddar Apr 8, 2021
80e72e9
adds placeholder secrets so that the UI loads on first run
rishabhpoddar Apr 9, 2021
bbf27a2
changes to readme
rishabhpoddar Apr 9, 2021
52e423b
updates version of supertokens frontend and backend SDK, and a few ot…
rishabhpoddar Apr 16, 2021
93b6588
Merge branch 'canary' into canary
rishabhpoddar Apr 16, 2021
c88554b
Update docs/authentication.md
rishabhpoddar Apr 20, 2021
121c5ae
Merge branch 'canary' into canary
rishabhpoddar Apr 20, 2021
3f8906b
Merge branch 'canary' into canary
rishabhpoddar Apr 20, 2021
5c7bf78
updates to readme for supertokens example
rishabhpoddar Apr 21, 2021
472ce2c
updates version of dependency
rishabhpoddar Apr 28, 2021
3f511eb
Merge branch 'canary' into canary
rishabhpoddar Apr 28, 2021
58b5e12
Merge branch 'canary' into canary
rishabhpoddar Apr 28, 2021
d2288cc
updates dependency version
rishabhpoddar May 3, 2021
687a9cb
Merge branch 'canary' into canary
rishabhpoddar May 3, 2021
4f8a48c
updates to dependencies
rishabhpoddar May 5, 2021
8976fa2
removes unnecessary config on frontend
rishabhpoddar May 5, 2021
889f8a4
Merge branch 'canary' into canary
rishabhpoddar May 5, 2021
652211c
changes how redirection is done post signout
rishabhpoddar May 12, 2021
538d794
update to dependency
rishabhpoddar May 13, 2021
a3f900c
Merge branch 'canary' into canary
rishabhpoddar May 13, 2021
0769b24
updates examples
rishabhpoddar Jun 17, 2021
2492e03
Merge branch 'canary' into canary
rishabhpoddar Jun 17, 2021
381c26f
updates code to use for new package
super-tokens Jul 11, 2021
8aef52c
updates dependencies
super-tokens Jul 11, 2021
3c88891
updates auth-react package
super-tokens Jul 11, 2021
a139dcc
Merge branch 'canary' of https://github.com/supertokens/next.js into …
super-tokens Jul 12, 2021
36e174c
Merge branch 'canary' into canary
rishabhpoddar Jul 12, 2021
0bfff12
with-supertokens example updated to use supertokens-node v7
bhumilsarvaiya Aug 26, 2021
8aeaa0e
updates dependency
super-tokens Aug 26, 2021
668eae4
Merge pull request #1 from supertokens/supertokens-node-7.x
rishabhpoddar Sep 8, 2021
33475d5
updates supertokens-node version
super-tokens Sep 8, 2021
be81b86
Merge branch 'canary' into canary
rishabhpoddar Sep 8, 2021
f1bf8dc
Update examples/with-supertokens/package.json
rishabhpoddar Sep 8, 2021
a10a2de
Merge branch 'canary' into canary
rishabhpoddar Sep 8, 2021
f8b8cd5
Merge branch 'canary' into canary
rishabhpoddar Sep 9, 2021
b7404ea
Merge branch 'canary' into canary
rishabhpoddar Sep 9, 2021
fbedc66
updates based on check-examples.sh script
super-tokens Sep 9, 2021
9a3b04a
linter fix
super-tokens Sep 9, 2021
a74b64a
updates supertokens-auth-react dependency version
super-tokens Oct 1, 2021
cd91f4f
Merge branch 'canary' into canary
rishabhpoddar Oct 1, 2021
a16c4b5
adds development OAuth key to example
jscyo Oct 13, 2021
d767c93
removes section from README
jscyo Oct 13, 2021
35b1fdd
Merge pull request #2 from supertokens/dev-oauth-keys
rishabhpoddar Oct 13, 2021
c06c01d
removes unnecessary file
super-tokens Oct 13, 2021
c723aae
Merge branch 'canary' into canary
rishabhpoddar Oct 13, 2021
b1afa9b
Merge branch 'canary' into canary
rishabhpoddar Oct 13, 2021
805e464
Merge branch 'canary' into canary
rishabhpoddar Oct 20, 2021
26efb9b
updates dependency versions
super-tokens Oct 22, 2021
0011b06
Merge branch 'canary' into canary
rishabhpoddar Oct 22, 2021
a6289b0
Merge branch 'canary' into canary
rishabhpoddar Oct 27, 2021
4d75763
Merge branch 'canary' into canary
rishabhpoddar Oct 31, 2021
9f915d1
Merge branch 'canary' into canary
rishabhpoddar Nov 1, 2021
31380c7
with-supertokens: reduced bundle size by removing node lib from bundle
Oct 29, 2021
d2986e4
Removed accidentally added config file
Nov 3, 2021
09f7911
Merge branch 'canary' into supertokens-reduced-bundle-size
super-tokens Nov 5, 2021
410bb9c
Merge pull request #3 from supertokens/supertokens-reduced-bundle-size
rishabhpoddar Nov 5, 2021
2736f86
Merge branch 'canary' into canary
rishabhpoddar Nov 6, 2021
c780496
adds sign in with apple
super-tokens Nov 9, 2021
2846bd0
Merge branch 'canary' into canary
rishabhpoddar Nov 9, 2021
7e6b654
Merge branch 'canary' into canary
rishabhpoddar Nov 9, 2021
cf5939b
extracted oauth keys to .env file
super-tokens Nov 9, 2021
72224ff
Merge branch 'canary' into canary
rishabhpoddar Nov 9, 2021
f29e792
Merge branch 'canary' into canary
jscyo Nov 9, 2021
83df50a
Merge branch 'canary' into canary
jscyo Nov 10, 2021
62462d8
Merge branch 'canary' into canary
jscyo Nov 11, 2021
41142e4
Merge branch 'canary' into canary
jscyo Nov 11, 2021
4fa2dcf
Merge branch 'canary' into canary
jscyo Nov 11, 2021
f884d9d
Merge branch 'canary' into canary
rishabhpoddar Nov 12, 2021
ce0970c
fixes node init issue race condition
super-tokens Dec 14, 2021
3b3a01e
removes unnecessary file
super-tokens Dec 14, 2021
fd8f57f
Merge pull request #4 from supertokens/fixes-node-init-issue
rishabhpoddar Dec 21, 2021
0256ca8
Merge pull request #1 from rishabhpoddar/canary
rishabhpoddar Dec 21, 2021
ce09b5e
updates supertokens-auth-react dependency
super-tokens Jan 17, 2022
cc6be6f
Merge branch 'canary' into canary
rishabhpoddar Jan 17, 2022
8e8572d
Merge branch 'canary' into canary
rishabhpoddar Jan 17, 2022
a3dadaa
Merge branch 'canary' into canary
rishabhpoddar Jan 17, 2022
afa8606
Merge branch 'canary' into canary
rishabhpoddar Jan 17, 2022
46f0212
updates superttokens-node dependency
super-tokens Feb 22, 2022
e8d50d2
Merge branch 'canary' of https://github.com/supertokens/next.js into …
super-tokens Feb 22, 2022
43d3181
Merge branch 'canary' into canary
rishabhpoddar Feb 22, 2022
72888f1
adds a cap to react dependency
super-tokens Feb 22, 2022
82a171f
updates eslint-config-next version
super-tokens Feb 22, 2022
44152f1
removes unnecessary dev dependency
super-tokens Feb 22, 2022
fd17695
Merge branch 'canary' into canary
rishabhpoddar Feb 22, 2022
48f7e03
Merge branch 'canary' into canary
rishabhpoddar Feb 22, 2022
7e09d8b
updates to latest version of supertokens-auth-react SDK
super-tokens Mar 3, 2022
4bbe9f0
Merge branch 'canary' into canary
rishabhpoddar Mar 3, 2022
d8978d7
Updated nextjs in supertokens example
Apr 7, 2022
3834a2a
Update examples/with-supertokens/package.json
rishabhpoddar Apr 7, 2022
a0cfddb
Update examples/with-supertokens/package.json
rishabhpoddar Apr 7, 2022
67f1db7
Merge pull request #3 from supertokens/updated_st_example
rishabhpoddar Apr 7, 2022
cf140f2
Merge branch 'canary' into canary
rishabhpoddar Apr 8, 2022
f4508e7
Update package.json
rishabhpoddar Apr 8, 2022
5994988
Merge branch 'canary' into canary
rishabhpoddar Apr 8, 2022
66c16d7
Update examples/with-supertokens/package.json
rishabhpoddar Apr 11, 2022
55bd67c
Update examples/with-supertokens/package.json
rishabhpoddar Apr 11, 2022
3a34c03
Merge branch 'canary' into canary
rishabhpoddar Apr 11, 2022
c6fd5e1
updates to supertokens-auth-react version
rishabhpoddar May 14, 2022
7246da6
Merge branch 'canary' into canary
rishabhpoddar May 14, 2022
7762a31
Merge branch 'canary' into canary
rishabhpoddar May 15, 2022
a6a687d
feat: update&improve ssr in with-supertokens
porcellus Jul 4, 2022
f347275
refactor: implement review feedback
porcellus Jul 4, 2022
e14f91e
refactor: moved everything into ProtectedPage to make Auth component …
porcellus Jul 4, 2022
30ecda5
refactor: implement review feedback
porcellus Jul 4, 2022
703f868
updates dependency version and uses nextjs router for navigation
rishabhpoddar Jul 6, 2022
5e1beb1
Merge pull request #4 from supertokens/ssr_improvements
rishabhpoddar Jul 6, 2022
82dabc2
Merge branch 'canary' into canary
rishabhpoddar Jul 6, 2022
94708bd
removes prettier dendency in with-supertokens example app
rishabhpoddar Jul 6, 2022
e519733
Merge branch 'canary' into canary
rishabhpoddar Jul 6, 2022
b9bdaa3
Merge branch 'canary' into canary
rishabhpoddar Jul 6, 2022
e2fbb16
Merge branch 'canary' into canary
rishabhpoddar Jul 6, 2022
8f59d24
docs(examples): updated supertokens example
porcellus Sep 6, 2022
c389226
Merge remote-tracking branch 'upstream/canary' into canary
porcellus Sep 9, 2022
7c8f285
Merge remote-tracking branch 'origin/canary' into examples/supertoken…
porcellus Sep 9, 2022
4beb328
Merge pull request #5 from supertokens/examples/supertokens/session_c…
rishabhpoddar Sep 20, 2022
6a2eac4
updates dependencies versions
rishabhpoddar Sep 20, 2022
39adbce
Merge branch 'canary' into canary
rishabhpoddar Sep 20, 2022
897d161
Merge branch 'canary' into canary
rishabhpoddar Sep 21, 2022
11b1f8e
Merge branch 'canary' into canary
rishabhpoddar Sep 21, 2022
afb8064
fixes linting
rishabhpoddar Sep 21, 2022
7ea96fb
Merge branch 'canary' of https://github.com/supertokens/next.js into …
rishabhpoddar Sep 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/with-supertokens/config/backendConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ThirdPartyEmailPasswordNode from 'supertokens-node/recipe/thirdpartyemailpassword'
import EmailVerificationNode from 'supertokens-node/recipe/emailverification'
import SessionNode from 'supertokens-node/recipe/session'
import { appInfo } from './appInfo'
import { AuthConfig } from '../interfaces'
Expand All @@ -11,6 +12,9 @@ export let backendConfig = (): AuthConfig => {
},
appInfo,
recipeList: [
EmailVerificationNode.init({
mode: 'REQUIRED',
}),
ThirdPartyEmailPasswordNode.init({
providers: [
// We have provided you with development keys which you can use for testing.
Expand Down
5 changes: 2 additions & 3 deletions examples/with-supertokens/config/frontendConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ThirdPartyEmailPasswordReact from 'supertokens-auth-react/recipe/thirdpartyemailpassword'
import EmailVerificationReact from 'supertokens-auth-react/recipe/emailverification'
import SessionReact from 'supertokens-auth-react/recipe/session'
import { appInfo } from './appInfo'
import Router from 'next/router'
Expand All @@ -7,10 +8,8 @@ export let frontendConfig = () => {
return {
appInfo,
recipeList: [
EmailVerificationReact.init(),
ThirdPartyEmailPasswordReact.init({
emailVerificationFeature: {
mode: 'REQUIRED',
},
signInAndUpFeature: {
providers: [
ThirdPartyEmailPasswordReact.Google.init(),
Expand Down
4 changes: 2 additions & 2 deletions examples/with-supertokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"supertokens-auth-react": "^0.24.7",
"supertokens-node": "^11.2.0"
"supertokens-auth-react": "^0.26.0",
"supertokens-node": "^12.0.0"
},
"devDependencies": {
"@types/react": "18.0.17",
Expand Down
6 changes: 4 additions & 2 deletions examples/with-supertokens/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import '../styles/globals.css'
import React from 'react'
import { useEffect } from 'react'
import SuperTokensReact, { SuperTokensWrapper } from 'supertokens-auth-react'
import SuperTokensReact, {
SuperTokensWrapper,
redirectToAuth,
} from 'supertokens-auth-react'
import * as SuperTokensConfig from '../config/frontendConfig'
import Session from 'supertokens-auth-react/recipe/session'
import { redirectToAuth } from 'supertokens-auth-react/recipe/thirdpartyemailpassword'

if (typeof window !== 'undefined') {
SuperTokensReact.init(SuperTokensConfig.frontendConfig())
Expand Down
21 changes: 13 additions & 8 deletions examples/with-supertokens/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react'
import Head from 'next/head'
import styles from '../styles/Home.module.css'
import ThirdPartyEmailPassword, {
ThirdPartyEmailPasswordAuth,
} from 'supertokens-auth-react/recipe/thirdpartyemailpassword'
import ThirdPartyEmailPassword from 'supertokens-auth-react/recipe/thirdpartyemailpassword'
import supertokensNode from 'supertokens-node'
import { backendConfig } from '../config/backendConfig'
import Session from 'supertokens-node/recipe/session'
import { useSessionContext } from 'supertokens-auth-react/recipe/session'
import {
SessionAuth,
useSessionContext,
} from 'supertokens-auth-react/recipe/session'
import { redirectToAuth } from 'supertokens-auth-react'

export async function getServerSideProps(context) {
// this runs on the backend, so we must call init on supertokens-node SDK
Expand All @@ -18,7 +20,10 @@ export async function getServerSideProps(context) {
} catch (err) {
if (err.type === Session.Error.TRY_REFRESH_TOKEN) {
return { props: { fromSupertokens: 'needs-refresh' } }
} else if (err.type === Session.Error.UNAUTHORISED) {
} else if (
err.type === Session.Error.UNAUTHORISED ||
err.type === Session.Error.INVALID_CLAIMS
) {
return { props: {} }
} else {
throw err
Expand All @@ -35,7 +40,7 @@ function ProtectedPage({ userId }) {

async function logoutClicked() {
await ThirdPartyEmailPassword.signOut()
ThirdPartyEmailPassword.redirectToAuth()
redirectToAuth()
}

async function fetchUserData() {
Expand Down Expand Up @@ -173,8 +178,8 @@ function ProtectedPage({ userId }) {

export default function Home(props) {
return (
<ThirdPartyEmailPasswordAuth>
<SessionAuth>
<ProtectedPage userId={props.userId} />
</ThirdPartyEmailPasswordAuth>
</SessionAuth>
)
}