@alore/auth-react-sdk 1.1.0-alpha.16 → 1.1.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types.d.ts +0 -5
- package/dist/utils/AloreAuth.d.ts +0 -44
- package/dist/utils/AloreAuth.js +0 -61
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -65,11 +65,6 @@ export interface AuthMachineContext {
|
|
|
65
65
|
salt?: string;
|
|
66
66
|
};
|
|
67
67
|
forgeData?: ForgeData;
|
|
68
|
-
googleOtpCode?: string;
|
|
69
|
-
googleUser?: {
|
|
70
|
-
email: string;
|
|
71
|
-
nickname: string;
|
|
72
|
-
};
|
|
73
68
|
sessionUser?: SessionUser;
|
|
74
69
|
CCRPublicKey?: {
|
|
75
70
|
publicKey: PublicKeyCredentialCreationOptions;
|
|
@@ -237,50 +237,6 @@ export declare class AloreAuth {
|
|
|
237
237
|
isNewUser: boolean;
|
|
238
238
|
emailChallenge?: undefined;
|
|
239
239
|
}>;
|
|
240
|
-
googleLogin: (context: AuthMachineContext, event: {
|
|
241
|
-
type: 'GOOGLE_LOGIN';
|
|
242
|
-
payload: {
|
|
243
|
-
accessToken: string;
|
|
244
|
-
providerName: string;
|
|
245
|
-
};
|
|
246
|
-
}) => Promise<{
|
|
247
|
-
googleOtpCode: any;
|
|
248
|
-
salt: any;
|
|
249
|
-
googleUser: {
|
|
250
|
-
email: any;
|
|
251
|
-
nickname: any;
|
|
252
|
-
salt: any;
|
|
253
|
-
};
|
|
254
|
-
sessionId: any;
|
|
255
|
-
isNewUser?: undefined;
|
|
256
|
-
socialProviderRegisterUser?: undefined;
|
|
257
|
-
} | {
|
|
258
|
-
isNewUser: boolean;
|
|
259
|
-
socialProviderRegisterUser: {
|
|
260
|
-
email: any;
|
|
261
|
-
nickname: any;
|
|
262
|
-
salt: any;
|
|
263
|
-
};
|
|
264
|
-
googleOtpCode?: undefined;
|
|
265
|
-
salt?: undefined;
|
|
266
|
-
googleUser?: undefined;
|
|
267
|
-
sessionId?: undefined;
|
|
268
|
-
} | {
|
|
269
|
-
googleOtpCode?: undefined;
|
|
270
|
-
salt?: undefined;
|
|
271
|
-
googleUser?: undefined;
|
|
272
|
-
sessionId?: undefined;
|
|
273
|
-
isNewUser?: undefined;
|
|
274
|
-
socialProviderRegisterUser?: undefined;
|
|
275
|
-
}>;
|
|
276
|
-
verifyGoogleLogin: (context: AuthMachineContext, event: {
|
|
277
|
-
type: 'COMPLETE_GOOGLE_SIGN_IN';
|
|
278
|
-
payload: {
|
|
279
|
-
email: string;
|
|
280
|
-
passwordHash: string;
|
|
281
|
-
otp: string;
|
|
282
|
-
};
|
|
283
|
-
}) => Promise<any>;
|
|
284
240
|
};
|
|
285
241
|
private delay;
|
|
286
242
|
private isLocalUrl;
|
package/dist/utils/AloreAuth.js
CHANGED
|
@@ -461,67 +461,6 @@ export class AloreAuth {
|
|
|
461
461
|
// as far as the onRegister/onLogin split in Auth.tsx.
|
|
462
462
|
return { sessionUser, isNewUser: response.status === 201 };
|
|
463
463
|
}),
|
|
464
|
-
// Google login flow
|
|
465
|
-
googleLogin: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
466
|
-
const { accessToken, providerName } = event.payload;
|
|
467
|
-
const { authProviderConfigs } = context;
|
|
468
|
-
const { firebaseCompatible } = authProviderConfigs || {};
|
|
469
|
-
const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/google-login${firebaseCompatible ? `?firebaseCompatibleToken=${firebaseCompatible}` : ''}`, {
|
|
470
|
-
method: 'POST',
|
|
471
|
-
headers: {
|
|
472
|
-
'Content-Type': 'application/json',
|
|
473
|
-
},
|
|
474
|
-
body: JSON.stringify({
|
|
475
|
-
accessToken,
|
|
476
|
-
provider: providerName,
|
|
477
|
-
}),
|
|
478
|
-
});
|
|
479
|
-
const data = yield response.json();
|
|
480
|
-
if (response.ok) {
|
|
481
|
-
return {
|
|
482
|
-
googleOtpCode: data.otpCode,
|
|
483
|
-
salt: data.salt,
|
|
484
|
-
googleUser: {
|
|
485
|
-
email: data.email,
|
|
486
|
-
nickname: data.nickname,
|
|
487
|
-
salt: data.salt,
|
|
488
|
-
},
|
|
489
|
-
sessionId: data.sessionId,
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
if (response.status === 404) {
|
|
493
|
-
return {
|
|
494
|
-
isNewUser: true,
|
|
495
|
-
socialProviderRegisterUser: {
|
|
496
|
-
email: data.email,
|
|
497
|
-
nickname: data.nickname,
|
|
498
|
-
salt: data.salt,
|
|
499
|
-
},
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
if (!response.ok)
|
|
503
|
-
yield this.throwParsedResponseError(response);
|
|
504
|
-
return {};
|
|
505
|
-
}),
|
|
506
|
-
verifyGoogleLogin: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
507
|
-
const { email, passwordHash, otp } = event.payload;
|
|
508
|
-
const response = yield this.fetchWithProgressiveBackoff('/auth/v1/google-2fa-verification', {
|
|
509
|
-
method: 'POST',
|
|
510
|
-
body: JSON.stringify({
|
|
511
|
-
email,
|
|
512
|
-
emailCode: otp,
|
|
513
|
-
passwordHash,
|
|
514
|
-
sessionId: context.sessionId,
|
|
515
|
-
}),
|
|
516
|
-
headers: {
|
|
517
|
-
'Content-Type': 'application/json',
|
|
518
|
-
},
|
|
519
|
-
});
|
|
520
|
-
const data = yield response.json();
|
|
521
|
-
if (response.ok)
|
|
522
|
-
return data;
|
|
523
|
-
throw new Error(data.message || data.error || 'Authentication failed');
|
|
524
|
-
}),
|
|
525
464
|
};
|
|
526
465
|
if (!clientId)
|
|
527
466
|
throw new AloreAuthError(ErrorTypes.CLIENT_ID_REQUIRED, 'Client ID is required');
|