Skip to content

Commit 284eeaa

Browse files
committed
Merge pull-request #515
2 parents c9e7857 + 233ae71 commit 284eeaa

File tree

3 files changed

+331
-12
lines changed

3 files changed

+331
-12
lines changed

.changeset/old-ghosts-obey.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@turnkey/sdk-browser": minor
3+
---
4+
5+
Add updateUserAuth, addUserAuth, deleteUserAuth helper functions

examples/react-components/src/app/dashboard/page.tsx

+13-12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
OtpVerification,
88
OtpType,
99
} from "@turnkey/sdk-react";
10+
1011
import { server } from "@turnkey/sdk-server";
1112
import { useEffect, useState } from "react";
1213
import "./dashboard.css";
@@ -131,12 +132,12 @@ export default function Dashboard() {
131132
toast.error("Email is already connected to another account");
132133
return;
133134
}
134-
await authIframeClient?.updateUser({
135-
organizationId: suborgId,
135+
136+
await authIframeClient?.addUserAuth({
136137
userId: user.userId,
137-
userEmail: emailInput,
138-
userTagIds: [],
138+
email: emailInput,
139139
});
140+
140141
const sendOtpResponse = await server.sendOtp({
141142
suborgID: suborgId,
142143
otpType: OtpType.Email,
@@ -165,12 +166,12 @@ export default function Dashboard() {
165166
toast.error("Phone Number is already connected to another account");
166167
return;
167168
}
168-
await authIframeClient?.updateUser({
169-
organizationId: suborgId,
169+
170+
await authIframeClient?.addUserAuth({
170171
userId: user.userId,
171-
userPhoneNumber: phoneInput,
172-
userTagIds: [],
172+
phoneNumber: phoneInput,
173173
});
174+
174175
const sendOtpResponse = await server.sendOtp({
175176
suborgID: suborgId,
176177
otpType: OtpType.Sms,
@@ -229,8 +230,8 @@ export default function Dashboard() {
229230
toast.error("Social login is already connected to another account");
230231
return;
231232
}
232-
await authIframeClient?.createOauthProviders({
233-
organizationId: suborgId,
233+
234+
await authIframeClient?.addUserAuth({
234235
userId: user.userId,
235236
oauthProviders: [
236237
{
@@ -260,8 +261,7 @@ export default function Dashboard() {
260261
})) || {};
261262

262263
if (encodedChallenge && attestation) {
263-
await authIframeClient?.createAuthenticators({
264-
organizationId: suborgId,
264+
await authIframeClient?.addUserAuth({
265265
userId: user.userId,
266266
authenticators: [
267267
{
@@ -271,6 +271,7 @@ export default function Dashboard() {
271271
},
272272
],
273273
});
274+
274275
window.location.reload();
275276
}
276277
};

0 commit comments

Comments
 (0)