Skip to content

Commit 4449dfd

Browse files
fix(elements): Add check for authenticable web3 strategy (clerk#3708)
1 parent 81d3cdd commit 4449dfd

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/elements": patch
3+
---
4+
5+
Fix isWeb3Strategy check to account for prefix and suffix

packages/elements/src/react/hooks/use-third-party-provider.hook.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { UseThirdPartyProviderReturn } from '~/react/common/connections';
1111
import {
1212
getEnabledThirdPartyProviders,
1313
isAuthenticatableOauthStrategy,
14+
isWeb3Strategy,
1415
providerToDisplayData,
1516
} from '~/utils/third-party-strategies';
1617

@@ -24,7 +25,10 @@ const useIsProviderEnabled = (provider: OAuthProvider | Web3Provider): boolean |
2425

2526
const data = getEnabledThirdPartyProviders(clerk.__unstable__environment);
2627

27-
return isAuthenticatableOauthStrategy(provider, data.authenticatableOauthStrategies);
28+
return (
29+
isAuthenticatableOauthStrategy(provider, data.authenticatableOauthStrategies) ||
30+
isWeb3Strategy(provider, data.web3Strategies)
31+
);
2832
};
2933

3034
export const useThirdPartyProvider = <

packages/elements/src/utils/third-party-strategies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function isWeb3Strategy(
5151
strategy: any,
5252
available: EnabledThirdPartyProviders['web3Strategies'],
5353
): strategy is Web3Strategy {
54-
return available.includes(strategy);
54+
return available.includes(strategy.startsWith('web3_') ? strategy : `web3_${strategy}_signature`);
5555
}
5656

5757
export function isAuthenticatableOauthStrategy(

0 commit comments

Comments
 (0)