Skip to content

Commit cfd86e1

Browse files
Merge pull request #92 from supertokens/docs/migration
docs: add migration guide in changelog and update example
2 parents d37e58e + d4c1d4c commit cfd86e1

File tree

5 files changed

+91
-25
lines changed

5 files changed

+91
-25
lines changed

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3434

3535
- Updates dependencies and backend config for the vue with-thirdpartyemailpassword example app
3636

37+
### Migration
38+
39+
#### Renamed parameters in `getAuthorisationURLWithQueryParamsAndSetState`
40+
41+
Before:
42+
43+
```
44+
const authUrl = await ThirdPartyEmailPassword.getAuthorisationURLWithQueryParamsAndSetState({
45+
providerId: "google",
46+
authorisationURL: `${websiteDomain}/auth/callback/google`,
47+
});
48+
```
49+
50+
After:
51+
52+
```
53+
const authUrl = await ThirdPartyEmailPassword.getAuthorisationURLWithQueryParamsAndSetState({
54+
thirdPartyId: "google",
55+
frontendRedirectURI: `${websiteDomain}/auth/callback/google`,
56+
});
57+
```
58+
59+
##### If the provider is redirecting to the backend directly (i.e.: Apple)
60+
61+
Before:
62+
63+
```
64+
const authUrl = await ThirdPartyEmailPassword.getAuthorisationURLWithQueryParamsAndSetState({
65+
providerId: "apple",
66+
authorisationURL: `${websiteDomain}/auth/callback/apple`,
67+
});
68+
```
69+
70+
After:
71+
72+
```
73+
const authUrl = await ThirdPartyEmailPassword.getAuthorisationURLWithQueryParamsAndSetState({
74+
thirdPartyId: "apple",
75+
frontendRedirectURI: `${websiteDomain}/auth/callback/apple`,
76+
redirectURIOnProviderDashboard: `${apiDomain}/auth/callback/apple`
77+
});
78+
```
79+
3780
## [0.6.0] - 2023-03-14
3881

3982
## Additions

examples/vuejs/with-thirdpartyemailpassword/api-server/index.ts

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,44 @@ supertokens.init({
3030
providers: [
3131
// We have provided you with development keys which you can use for testing.
3232
// IMPORTANT: Please replace them with your own OAuth keys for production use.
33-
ThirdPartyEmailPassword.Google({
34-
clientId: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
35-
clientSecret: "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",
36-
}),
37-
ThirdPartyEmailPassword.Github({
38-
clientSecret: "e97051221f4b6426e8fe8d51486396703012f5bd",
39-
clientId: "467101b197249757c71f",
40-
}),
41-
ThirdPartyEmailPassword.Apple({
42-
clientId: "4398792-io.supertokens.example.service",
43-
clientSecret: {
44-
keyId: "7M48Y4RYDL",
45-
privateKey:
46-
"-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
47-
teamId: "YWQCXGJRJL",
33+
{
34+
config: {
35+
thirdPartyId: "google",
36+
clients: [
37+
{
38+
clientId: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
39+
clientSecret: "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",
40+
},
41+
],
4842
},
49-
}),
43+
},
44+
{
45+
config: {
46+
thirdPartyId: "github",
47+
clients: [
48+
{
49+
clientId: "467101b197249757c71f",
50+
clientSecret: "e97051221f4b6426e8fe8d51486396703012f5bd",
51+
},
52+
],
53+
},
54+
},
55+
{
56+
config: {
57+
thirdPartyId: "apple",
58+
clients: [
59+
{
60+
clientId: "4398792-io.supertokens.example.service",
61+
additionalConfig: {
62+
keyId: "7M48Y4RYDL",
63+
privateKey:
64+
"-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
65+
teamId: "YWQCXGJRJL",
66+
},
67+
},
68+
],
69+
},
70+
},
5071
],
5172
}),
5273
Session.init(),

examples/vuejs/with-thirdpartyemailpassword/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"express": "^4.17.3",
1818
"helmet": "^5.0.2",
1919
"pinia": "^2.0.13",
20-
"supertokens-node": "^13.1.5",
21-
"supertokens-web-js": "^0.5.0",
20+
"supertokens-node": "latest",
21+
"supertokens-web-js": "latest",
2222
"ts-node-dev": "^2.0.0",
2323
"vue": "^3.2.31",
2424
"vue-router": "^4.0.14"

examples/vuejs/with-thirdpartyemailpassword/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import App from "./App.vue";
88
import router from "./router";
99

1010
const apiPort = import.meta.env.VUE_APP_API_PORT || 3001;
11-
const apiDomain = import.meta.env.VUE_APP_API_URL || `http://localhost:${apiPort}`;
11+
export const apiDomain = import.meta.env.VUE_APP_API_URL || `http://localhost:${apiPort}`;
1212

1313
SuperTokens.init({
1414
appInfo: {

examples/vuejs/with-thirdpartyemailpassword/src/views/AuthView.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import ThirdPartyEmailPassword from "supertokens-web-js/recipe/thirdpartyemailpassword";
33
import Session from "supertokens-web-js/recipe/session";
44
import { defineComponent } from "vue";
5+
import { apiDomain } from "../main";
56
67
const websitePort = import.meta.env.VUE_APP_WEB_PORT || 3000;
78
const websiteDomain = import.meta.env.VUE_APP_WEB_URL || `http://localhost:${websitePort}`;
@@ -145,33 +146,34 @@ export default defineComponent({
145146
},
146147
onGithubPressed: async function () {
147148
const authUrl = await ThirdPartyEmailPassword.getAuthorisationURLWithQueryParamsAndSetState({
148-
providerId: "github",
149+
thirdPartyId: "github",
149150
150151
// This is where github should redirect the user back after login or error.
151152
// This URL goes on the github dashboard as well.
152-
authorisationURL: `${websiteDomain}/auth/callback/github`,
153+
frontendRedirectURI: `${websiteDomain}/auth/callback/github`,
153154
});
154155
155156
window.location.assign(authUrl);
156157
},
157158
onGooglePressed: async function () {
158159
const authUrl = await ThirdPartyEmailPassword.getAuthorisationURLWithQueryParamsAndSetState({
159-
providerId: "google",
160+
thirdPartyId: "google",
160161
161162
// This is where google should redirect the user back after login or error.
162163
// This URL goes on the google dashboard as well.
163-
authorisationURL: `${websiteDomain}/auth/callback/google`,
164+
frontendRedirectURI: `${websiteDomain}/auth/callback/google`,
164165
});
165166
166167
window.location.assign(authUrl);
167168
},
168169
onApplePressed: async function () {
169170
const authUrl = await ThirdPartyEmailPassword.getAuthorisationURLWithQueryParamsAndSetState({
170-
providerId: "apple",
171+
thirdPartyId: "apple",
171172
172173
// This is where apple should redirect the user back after login or error.
173174
// This URL goes on the apple dashboard as well.
174-
authorisationURL: `${websiteDomain}/auth/callback/apple`,
175+
frontendRedirectURI: `${websiteDomain}/auth/callback/apple`,
176+
redirectURIOnProviderDashboard: `${apiDomain}/auth/callback/apple`,
175177
});
176178
177179
window.location.assign(authUrl);

0 commit comments

Comments
 (0)