File tree Expand file tree Collapse file tree 6 files changed +26
-1
lines changed Expand file tree Collapse file tree 6 files changed +26
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ Add new auth fields to support redirect in web and electron applications
Original file line number Diff line number Diff line change @@ -181,6 +181,8 @@ export const ConnectWalletSocialOptions = (
181
181
authOption : strategy ,
182
182
client : props . client ,
183
183
ecosystem : ecosystemInfo ,
184
+ redirectUrl : walletConfig ?. auth ?. redirectUrl ,
185
+ redirectExternally : walletConfig ?. auth ?. redirectExternally ,
184
186
} ) ;
185
187
}
186
188
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ export function SocialLogin(props: {
63
63
partnerId : wallet . getConfig ( ) ?. partnerId ,
64
64
}
65
65
: undefined ,
66
+ redirectUrl : walletConfig ?. auth ?. redirectUrl ,
67
+ redirectExternally : walletConfig ?. auth ?. redirectExternally ,
66
68
} ) ;
67
69
}
68
70
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ export type EcosystemWalletCreationOptions = {
7
7
partnerId ?: string ;
8
8
auth ?: {
9
9
mode ?: "popup" | "redirect" ;
10
+ redirectUrl ?: string ;
11
+ redirectExternally ?: boolean ;
10
12
} ;
11
13
} ;
12
14
Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ export type InAppWalletCreationOptions =
37
37
* Whether to display the social auth prompt in a popup or redirect
38
38
*/
39
39
mode ?: "popup" | "redirect" ;
40
+ /**
41
+ * Optional url to redirect to after authentication
42
+ */
43
+ redirectUrl ?: string ;
44
+ /**
45
+ * Whether to handle the redirect in a new window
46
+ */
47
+ redirectExternally ?: boolean ;
40
48
/**
41
49
* The domain of the passkey to use for authentication
42
50
*/
Original file line number Diff line number Diff line change @@ -30,12 +30,18 @@ export const loginWithOauthRedirect = (options: {
30
30
authOption : SocialAuthOption ;
31
31
client : ThirdwebClient ;
32
32
ecosystem ?: Ecosystem ;
33
+ redirectUrl ?: string ;
34
+ redirectExternally ?: boolean ;
33
35
} ) : void => {
34
36
const loginUrl = getLoginUrl ( {
35
37
...options ,
36
38
mode : "redirect" ,
37
39
} ) ;
38
- window . location . href = loginUrl ;
40
+ if ( options . redirectExternally === true ) {
41
+ window . open ( loginUrl ) ;
42
+ } else {
43
+ window . location . href = loginUrl ;
44
+ }
39
45
} ;
40
46
41
47
export const loginWithOauth = async ( options : {
You can’t perform that action at this time.
0 commit comments