7
7
OtpVerification ,
8
8
OtpType ,
9
9
} from "@turnkey/sdk-react" ;
10
+
10
11
import { server } from "@turnkey/sdk-server" ;
11
12
import { useEffect , useState } from "react" ;
12
13
import "./dashboard.css" ;
@@ -131,12 +132,12 @@ export default function Dashboard() {
131
132
toast . error ( "Email is already connected to another account" ) ;
132
133
return ;
133
134
}
134
- await authIframeClient ?. updateUser ( {
135
- organizationId : suborgId ,
135
+
136
+ await authIframeClient ?. addUserAuth ( {
136
137
userId : user . userId ,
137
- userEmail : emailInput ,
138
- userTagIds : [ ] ,
138
+ email : emailInput ,
139
139
} ) ;
140
+
140
141
const sendOtpResponse = await server . sendOtp ( {
141
142
suborgID : suborgId ,
142
143
otpType : OtpType . Email ,
@@ -165,12 +166,12 @@ export default function Dashboard() {
165
166
toast . error ( "Phone Number is already connected to another account" ) ;
166
167
return ;
167
168
}
168
- await authIframeClient ?. updateUser ( {
169
- organizationId : suborgId ,
169
+
170
+ await authIframeClient ?. addUserAuth ( {
170
171
userId : user . userId ,
171
- userPhoneNumber : phoneInput ,
172
- userTagIds : [ ] ,
172
+ phoneNumber : phoneInput ,
173
173
} ) ;
174
+
174
175
const sendOtpResponse = await server . sendOtp ( {
175
176
suborgID : suborgId ,
176
177
otpType : OtpType . Sms ,
@@ -229,8 +230,8 @@ export default function Dashboard() {
229
230
toast . error ( "Social login is already connected to another account" ) ;
230
231
return ;
231
232
}
232
- await authIframeClient ?. createOauthProviders ( {
233
- organizationId : suborgId ,
233
+
234
+ await authIframeClient ?. addUserAuth ( {
234
235
userId : user . userId ,
235
236
oauthProviders : [
236
237
{
@@ -260,8 +261,7 @@ export default function Dashboard() {
260
261
} ) ) || { } ;
261
262
262
263
if ( encodedChallenge && attestation ) {
263
- await authIframeClient ?. createAuthenticators ( {
264
- organizationId : suborgId ,
264
+ await authIframeClient ?. addUserAuth ( {
265
265
userId : user . userId ,
266
266
authenticators : [
267
267
{
@@ -271,6 +271,7 @@ export default function Dashboard() {
271
271
} ,
272
272
] ,
273
273
} ) ;
274
+
274
275
window . location . reload ( ) ;
275
276
}
276
277
} ;
0 commit comments