Skip to content

Commit

Permalink
Updates with-supertokens example to add sign in with apple (#31200)
Browse files Browse the repository at this point in the history
Co-authored-by: Lee Robinson <me@leerob.io>
  • Loading branch information
rishabhpoddar and leerob committed Nov 13, 2021
1 parent 9952cc7 commit f6c62d3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
14 changes: 14 additions & 0 deletions examples/with-supertokens/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are all working development keys.
# IMPORTANT: You can use them during development, but for production use,
# make sure to change them to keys issued for your app.

GOOGLE_CLIENT_ID=1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=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

GITHUB_CLIENT_ID=467101b197249757c71f
GITHUB_CLIENT_SECRET=e97051221f4b6426e8fe8d51486396703012f5bd

APPLE_CLIENT_ID=4398792-io.supertokens.example.service
APPLE_KEY_ID=7M48Y4RYDL
APPLE_TEAM_ID=YWQCXGJRJL
APPLE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----
3 changes: 2 additions & 1 deletion examples/with-supertokens/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ yarn create next-app --example with-supertokens with-supertokens-app

## Notes

Take a look at [SuperTokens documentation](https://supertokens.io/docs/community/introduction).
- Take a look at [SuperTokens documentation](https://supertokens.io/docs/community/introduction).
- We have provided development OAuth keys for the various in build third party providers in the `.env` file. Feel free to use them for development purposes, but **please create your own keys for production use**.
21 changes: 12 additions & 9 deletions examples/with-supertokens/config/backendConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ export let backendConfig = () => {
// 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.
ThirdPartyEmailPasswordNode.Google({
clientId:
'1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com',
clientSecret: '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',
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
ThirdPartyEmailPasswordNode.Github({
clientId: '467101b197249757c71f',
clientSecret: 'e97051221f4b6426e8fe8d51486396703012f5bd',
clientId: process.env.GITHUB_CLIENT_ID,
clientSecret: process.env.GITHUB_CLIENT_SECRET,
}),
ThirdPartyEmailPasswordNode.Apple({
clientId: process.env.APPLE_CLIENT_ID,
clientSecret: {
keyId: process.env.APPLE_KEY_ID,
privateKey: process.env.APPLE_PRIVATE_KEY.replace(/\\n/g, '\n'),
teamId: process.env.APPLE_TEAM_ID,
},
}),
// ThirdPartyEmailPasswordNode.Facebook({
// clientSecret: process.env.FACEBOOK_CLIENT_SECRET || 'PLACEHOLDER',
// clientId: process.env.FACEBOOK_CLIENT_ID || 'PLACEHOLDER',
// }),
],
}),
SessionNode.init(),
Expand Down
1 change: 1 addition & 0 deletions examples/with-supertokens/config/frontendConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export let frontendConfig = () => {
providers: [
ThirdPartyEmailPasswordReact.Google.init(),
ThirdPartyEmailPasswordReact.Github.init(),
ThirdPartyEmailPasswordReact.Apple.init(),
],
},
}),
Expand Down
2 changes: 1 addition & 1 deletion examples/with-supertokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"react": "17.0.1",
"react-dom": "17.0.1",
"supertokens-auth-react": "^0.17.0",
"supertokens-node": "^8.0.0"
"supertokens-node": "^8.1.0"
},
"devDependencies": {
"eslint-config-next": "11.0.1"
Expand Down

1 comment on commit f6c62d3

@emmanuelusalazar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Please sign in to comment.