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

fix: version updates and changelog #645

Merged
merged 13 commits into from
Jul 19, 2023
Merged
254 changes: 254 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,260 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [15.0.0]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
## [15.0.0]
## [15.0.0] - 2023-07-19

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done


### Added

- Added Multitenancy Recipe & always initialized by default.
- Adds Multitenancy support to all the recipes
- Added new Social login providers - LinkedIn
- Added new Multi-tenant SSO providers - Okta, Active Directory, Boxy SAML
- All APIs handled by Supertokens middleware can have an optional `tenantId` prefixed in the path. e.g. <basePath>/<tenantId>/signinup

### Breaking changes

- `getUsersOldestFirst` & `getUsersNewestFirst` has mandatory parameter `tenantId`. Pass `'public'` if not using multitenancy.
- Added mandatory field `tenantId` to `EmailDeliveryInterface` and `SmsDeliveryInterface`
- Added mandatory parameter/field `tenantId` to API interfaces, Recipe interfaces and Recipe functions. Pass `'public'` if not using multitenancy.
- Removed deprecated config `createAndSendCustomEmail` and `createAndSendCustomTextMessage`.
- Added `tenantId` to `fetchValue` function in `PrimitiveClaim`, `PrimitiveArrayClaim`.
- TypeProvider interface is re-written
- In the thirdparty, thirdpartyemailpassword and thirdpartypasswordless, the providers array accepts `[]ProviderInput` instead of `[]TypeProvider`
- Updated `authorisationUrlGET` API
- Changed: Doesn't accept `clientId` anymore and accepts `clientType` instead to determine the matching config
- Added: optional `pkceCodeVerifier` in the response, to support PKCE
- Updated `signInUpPOST` API
- Removed: `clientId`, `redirectURI`, `authCodeResponse` and `code` from the input
- Instead,
- accepts `clientType` to determine the matching config
- One of redirectURIInfo (for code flow) or oAuthTokens (for token flow) is required
- Updated `appleRedirectHandlerPOST`
- to accept all the form fields instead of just the code
- to use redirect URI encoded in the `state` parameter instead of using the websiteDomain config.
- to use HTTP 303 instead of javascript based redirection.
- Updated `signInUp` recipe interface function in thirdparty with new parameters:
- `oAuthTokens` - contains all the tokens (access_token, id_token, etc.) as returned by the provider
- `rawUserInfoFromProvider` - contains all the user profile info as returned by the provider
- Added `manuallyCreateOrUpdateUser` recipe function in thirdparty recipe instead, to be used in place of `signInUp`

Copy link
Member

Choose a reason for hiding this comment

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

list all functions that have changed in sigature - go recipe wise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

### Migration
Copy link
Member

Choose a reason for hiding this comment

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

do not make it 1, 2, 3.. make it a ####

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done


1. To call any recipe function that has `tenantId` added to it, pass `'public`'

Before:

```ts
EmailPassword.signUp("test@example.com", "password");
```

After:

```ts
EmailPassword.signUp("public", "test@example.com", "password");
```

2. Input for provider array change as follows:

Before:

```ts
let googleProvider = thirdParty.Google({
clientID: "...",
clientSecret: "...",
});
```

After:

```ts
let googleProvider = {
config: {
thirdPartyId: "google",
clients: [{ clientId: "...", clientSecret: "..." }],
},
};
```

3. Single instance with multiple clients of each provider instead of multiple instances of them. Also use `clientType` to differentiate them. `clientType` passed from the frontend will be used to determine the right config.

Before:

```ts
let providers = [
thirdParty.Google({
clientID: "clientid1",
clientSecret: "...",
}),
thirdParty.Google({
clientID: "clientid2",
clientSecret: "...",
}),
];
```

After:

```ts
let providers = [
{
config: {
thirdPartyId: "google",
clients: [
{ clientId: "clientid1", clientSecret: "..." },
{ clientId: "clientid2", clientSecret: "..." },
Copy link
Member

Choose a reason for hiding this comment

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

need clientType here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

],
},
},
];
```

4. Change in the implementation of custom providers

- All config is part of `ProviderInput`
- To update `authorisationRedirect.Params` dynamically, `getAuthorisationRedirectURL` must be overridden
Copy link
Member

Choose a reason for hiding this comment

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

move it to the next point or move it from here entirely.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

- To provide implementation for `getProfileInfo`
- either use `userInfoEndpoint`, `userInfoEndpointQueryParams` and `userInfoMap` to fetch the user info from the provider
- or specify custom implementation in an override for `getUserInfo`

Before:

```ts
let customProvider = {
id: "custom",
get: (redirectURI, authCodeFromRequest) => {
return {
accessTokenAPI: {
url: "...",
params: {},
},
authorisationRedirect: {
url: "...",
params: {},
},
getClientId: () => {
return "...";
},
getProfileInfo: async (accessTokenAPIResponse) => {
return {
id: "...",
email: {
id: "...",
isVerified: true,
},
};
},
};
},
};
```

After:

```ts
let customProvider = {
config: {
thirdPartyID: "custom",
clients: [
{
clientId: "...",
clientSecret: "...",
},
],
authorizationEndpoint: "...",
authorizationEndpointQueryParams: {},
tokenEndpoint: "...",
tokenEndpointBodyParams: {},
userInfoEndpoint: "...",
userInfoEndpointQueryParams: {},
userInfoMap: {
fromUserInfoAPI: {
userId: "id",
email: "email",
emailVerified: "email_verified",
},
},
},
};
```

Also, if the custom provider supports openid, it can automatically discover the endpoints

```ts
let customProvider = {
config: {
thirdPartyID: "custom",
clients: [
{
clientId: "...",
clientSecret: "...",
},
],
oidcDiscoveryEndpoint: "...",
userInfoMap: {
fromUserInfoAPI: {
userId: "id",
email: "email",
emailVerified: "email_verified",
},
},
},
};
```

Note: the SDK will fetch the oauth2 endpints from the providered OIDC discovery endpoint url + '/.well-known/openid-configuration'
Copy link
Member

Choose a reason for hiding this comment

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

typo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Properly format.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done


5. Any of the functions in the TypeProvider can be overridden for custom implementation

```ts
let customProvider = {
config: {
thirdPartyID: "custom",
clients: [
{
clientId: "...",
clientSecret: "...",
},
],
oidcDiscoveryEndpoint: "...",
userInfoMap: {
fromUserInfoAPI: {
userId: "id",
email: "email",
emailVerified: "email_verified",
},
},
},
override: (originalImplementation) => {
return {
...originalImplementation,
getAuthorisationRedirectURL: async (input) => {
let result = await originalImplementation.getAuthorisationRedirectURL(input);
// ...
return result;
},

exchangeAuthCodeForOAuthTokens: async (input) => {
let result = await originalImplementation.exchangeAuthCodeForOAuthTokens(input);
// ...
return result;
},

getUserInfo: async (input) => {
let result = await originalImplementation.getUserInfo(input);
// ...
return result;
},
};
},
};
```

Copy link
Member

Choose a reason for hiding this comment

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

also mention change in how to get access token from the provider

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

### Changes

- Adds optional param `tenantId` to `getUserCount` which returns total count across all tenants if not passed.
- Adds protected prop `tId` to the accessToken payload
- Adds `includesAny` claim validator to `PrimitiveArrayClaim`

### Fixes

- Fixed an issue where certain Dashboard API routes would return a 404 for Hapi
Expand Down
2 changes: 1 addition & 1 deletion coreDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_comment": "contains a list of core-driver interfaces branch names that this core supports",
"versions": ["2.21"]
"versions": ["3.0"]
}
2 changes: 1 addition & 1 deletion frontendDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_comment": "contains a list of frontend-driver interfaces branch names that this core supports",
"versions": ["1.16"]
"versions": ["1.17"]
}
4 changes: 4 additions & 0 deletions lib/build/recipe/thirdparty/providers/googleWorkspaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ function GoogleWorkspaces(input) {
return __awaiter(this, void 0, void 0, function* () {
const config = yield oGetConfig(input);
config.additionalConfig = Object.assign({ hd: "*" }, config.additionalConfig);
config.authorizationEndpointQueryParams = Object.assign(
Object.assign({}, config.authorizationEndpointQueryParams),
{ hd: config.additionalConfig.hd }
);
return config;
});
};
Expand Down
2 changes: 1 addition & 1 deletion lib/build/version.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/build/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions lib/ts/recipe/thirdparty/providers/googleWorkspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ export default function GoogleWorkspaces(input: ProviderInput): TypeProvider {
...config.additionalConfig,
};

config.authorizationEndpointQueryParams = {
...config.authorizationEndpointQueryParams,
hd: config.additionalConfig.hd,
};

return config;
};

Expand Down
2 changes: 1 addition & 1 deletion lib/ts/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
export const version = "14.1.3";
export const version = "15.0.0";

export const cdiSupported = ["3.0"];

rishabhpoddar marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supertokens-node",
"version": "14.1.3",
"version": "15.0.0",
"description": "NodeJS driver for SuperTokens core",
"main": "index.js",
"scripts": {
Expand Down
8 changes: 0 additions & 8 deletions test/emailpassword/passwordreset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,6 @@ describe(`passwordreset: ${printPath("[test/emailpassword/passwordreset.test.js]
},
},
},
// resetPasswordUsingTokenFeature: {

// // createAndSendCustomEmail: (user, passwordResetURLWithToken) => {
// // resetURL = passwordResetURLWithToken.split("?")[0];
// // tokenInfo = passwordResetURLWithToken.split("?")[1].split("&")[0];
// // ridInfo = passwordResetURLWithToken.split("?")[1].split("&")[1];
// // },
// },
}),
Session.init({ getTokenTransferMethod: () => "cookie" }),
],
Expand Down
Loading
Loading