Skip to content

Commit

Permalink
fix: handle null in provider list of the tenant config
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Aug 27, 2023
1 parent 1f5c5dd commit ac38eb3
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 45 deletions.
23 changes: 20 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.34.2] - 2023-08-27

### Fixes

- Fixed the SDK trying to merge the providers from the tenant config if the third party login method is disabled.

## [0.34.1] - 2023-07-31

### Changes
Expand Down Expand Up @@ -35,43 +41,54 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Backend SDKs have to be updated first to a version that supports multi-tenancy for thirdparty
- supertokens-node: >= 15.0.0
- In ThirdParty recipe,

- Changed signatures of the functions `getAuthorisationURLWithQueryParamsAndSetState`

```diff
import { getAuthorisationURLWithQueryParamsAndSetState } from 'supertokens-auth-react/recipe/thirdparty';

getAuthorisationURLWithQueryParamsAndSetState({
- providerId: "google",
+ thirdPartyId: "google",
- authorisationURL: "http://localhost/auth/callback/google",
+ frontendRedirectURI: "http://localhost/auth/callback/google",
});
```

- Removed functions - `setStateAndOtherInfoToStorage`, `getAuthorisationURLFromBackend`, `generateStateToSendToOAuthProvider`, `verifyAndGetStateOrThrowError`, `getAuthCodeFromURL`, `getAuthErrorFromURL`, `getAuthStateFromURL`

- In ThirdPartyEmailpassword recipe,

- Changed signatures of the functions `getAuthorisationURLWithQueryParamsAndSetState`

```diff
import { getAuthorisationURLWithQueryParamsAndSetState } from 'supertokens-auth-react/recipe/thirdpartyemailpassword';

getAuthorisationURLWithQueryParamsAndSetState({
- providerId: "google",
+ thirdPartyId: "google",
- authorisationURL: "http://localhost/auth/callback/google",
+ frontendRedirectURI: "http://localhost/auth/callback/google",
});
```

- Removed functions - `setStateAndOtherInfoToStorage`, `getAuthorisationURLFromBackend`, `generateStateToSendToOAuthProvider`, `verifyAndGetStateOrThrowError`, `getAuthCodeFromURL`, `getAuthErrorFromURL`, `getAuthStateFromURL`

- In ThirdPartyPasswordless recipe,

- Changed signatures of the functions `getThirdPartyAuthorisationURLWithQueryParamsAndSetState`

```diff
import { getAuthorisationURLWithQueryParamsAndSetState } from 'supertokens-auth-react/recipe/thirdpartypasswordless';

getAuthorisationURLWithQueryParamsAndSetState({
- providerId: "google",
+ thirdPartyId: "google",
- authorisationURL: "http://localhost/auth/callback/google",
+ frontendRedirectURI: "http://localhost/auth/callback/google",
});
```

- Removed functions - `setThirdPartyStateAndOtherInfoToStorage`, `getAuthorisationURLFromBackend`, `generateThirdPartyStateToSendToOAuthProvider`, `verifyAndGetThirdPartyStateOrThrowError`, `getThirdPartyAuthCodeFromURL`, `getThirdPartyAuthErrorFromURL`, `getThirdPartyAuthStateFromURL`

## [0.33.1] - 2023-06-08
Expand Down
2 changes: 1 addition & 1 deletion examples/for-tests-react-16/src/testContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getTestContext() {
mockLoginMethodsForDynamicLogin: localStorage.getItem("mockLoginMethodsForDynamicLogin"),
staticProviderList: localStorage.getItem("staticProviderList"),
mockTenantId: localStorage.getItem("mockTenantId"),
clientType: localStorage.getItem("clientType"),
clientType: localStorage.getItem("clientType") || undefined,
};
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/for-tests/src/testContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getTestContext() {
mockLoginMethodsForDynamicLogin: localStorage.getItem("mockLoginMethodsForDynamicLogin"),
staticProviderList: localStorage.getItem("staticProviderList"),
mockTenantId: localStorage.getItem("mockTenantId"),
clientType: localStorage.getItem("clientType"),
clientType: localStorage.getItem("clientType") || undefined,
};
return ret;
}
Expand Down
12 changes: 7 additions & 5 deletions lib/build/thirdparty-shared.js

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

4 changes: 3 additions & 1 deletion lib/build/thirdparty-shared2.js

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.d.ts

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

Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export function useChildProps(recipe: Recipe | undefined): ThirdPartySignInUpChi
if (dynamicLoginMethods.loaded === false) {
throw new Error("Component requiring dynamicLoginMethods rendered without FeatureWrapper.");
} else {
tenantProviders = dynamicLoginMethods.loginMethods.thirdparty.providers;
tenantProviders = dynamicLoginMethods.loginMethods.thirdparty.enabled
? dynamicLoginMethods.loginMethods.thirdparty.providers
: [];
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/ts/recipe/thirdparty/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ export async function redirectToThirdPartyLogin(input: {
const loginMethods = await Multitenancy.getInstanceOrThrow().getCurrentDynamicLoginMethods({
userContext: input.userContext,
});
const tenantProviders = loginMethods?.thirdparty.enabled ? loginMethods.thirdparty.providers : [];
const providers = mergeProviders({
tenantProviders: loginMethods?.thirdparty.providers,
tenantProviders,
clientProviders: input.config.signInAndUpFeature.providers,
});

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,4 +12,4 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
export const package_version = "0.34.1";
export const package_version = "0.34.2";
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supertokens-auth-react",
"version": "0.34.1",
"version": "0.34.2",
"description": "ReactJS SDK that provides login functionality with SuperTokens.",
"main": "./index.js",
"engines": {
Expand Down Expand Up @@ -83,7 +83,7 @@
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"supertokens-web-js": "^0.7.0"
"supertokens-web-js": "^0.7.2"
},
"scripts": {
"init": "bash ./init.sh",
Expand Down
Loading

0 comments on commit ac38eb3

Please sign in to comment.