@blackcode_sa/metaestetics-api 1.12.11 → 1.12.12
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/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -14
- package/dist/index.mjs +6 -14
- package/package.json +1 -1
- package/src/services/auth/auth.service.ts +6 -25
package/dist/index.d.mts
CHANGED
|
@@ -6197,11 +6197,11 @@ declare class AuthService extends BaseService {
|
|
|
6197
6197
|
* with the platform-specific client ID (no client secret needed for native apps).
|
|
6198
6198
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
6199
6199
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
6200
|
-
* @param
|
|
6200
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
6201
6201
|
* @param initialRole - The role to assign to the user if they are being created.
|
|
6202
6202
|
* @returns The signed-in or newly created user.
|
|
6203
6203
|
*/
|
|
6204
|
-
signInWithGoogleAuthCode(authorizationCode: string, redirectUri: string,
|
|
6204
|
+
signInWithGoogleAuthCode(authorizationCode: string, redirectUri: string, clientId: string, initialRole?: UserRole): Promise<User>;
|
|
6205
6205
|
/**
|
|
6206
6206
|
* Links a Google account to the currently signed-in user using an ID token.
|
|
6207
6207
|
* This is used to upgrade an anonymous user or to allow an existing user
|
|
@@ -6216,10 +6216,10 @@ declare class AuthService extends BaseService {
|
|
|
6216
6216
|
* with the platform-specific client ID, then links the Google account to the current user.
|
|
6217
6217
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
6218
6218
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
6219
|
-
* @param
|
|
6219
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
6220
6220
|
* @returns The updated user profile.
|
|
6221
6221
|
*/
|
|
6222
|
-
linkGoogleAccountWithAuthCode(authorizationCode: string, redirectUri: string,
|
|
6222
|
+
linkGoogleAccountWithAuthCode(authorizationCode: string, redirectUri: string, clientId: string): Promise<User>;
|
|
6223
6223
|
}
|
|
6224
6224
|
|
|
6225
6225
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -6197,11 +6197,11 @@ declare class AuthService extends BaseService {
|
|
|
6197
6197
|
* with the platform-specific client ID (no client secret needed for native apps).
|
|
6198
6198
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
6199
6199
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
6200
|
-
* @param
|
|
6200
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
6201
6201
|
* @param initialRole - The role to assign to the user if they are being created.
|
|
6202
6202
|
* @returns The signed-in or newly created user.
|
|
6203
6203
|
*/
|
|
6204
|
-
signInWithGoogleAuthCode(authorizationCode: string, redirectUri: string,
|
|
6204
|
+
signInWithGoogleAuthCode(authorizationCode: string, redirectUri: string, clientId: string, initialRole?: UserRole): Promise<User>;
|
|
6205
6205
|
/**
|
|
6206
6206
|
* Links a Google account to the currently signed-in user using an ID token.
|
|
6207
6207
|
* This is used to upgrade an anonymous user or to allow an existing user
|
|
@@ -6216,10 +6216,10 @@ declare class AuthService extends BaseService {
|
|
|
6216
6216
|
* with the platform-specific client ID, then links the Google account to the current user.
|
|
6217
6217
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
6218
6218
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
6219
|
-
* @param
|
|
6219
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
6220
6220
|
* @returns The updated user profile.
|
|
6221
6221
|
*/
|
|
6222
|
-
linkGoogleAccountWithAuthCode(authorizationCode: string, redirectUri: string,
|
|
6222
|
+
linkGoogleAccountWithAuthCode(authorizationCode: string, redirectUri: string, clientId: string): Promise<User>;
|
|
6223
6223
|
}
|
|
6224
6224
|
|
|
6225
6225
|
/**
|
package/dist/index.js
CHANGED
|
@@ -10401,21 +10401,17 @@ var AuthService = class extends BaseService {
|
|
|
10401
10401
|
* with the platform-specific client ID (no client secret needed for native apps).
|
|
10402
10402
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
10403
10403
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
10404
|
-
* @param
|
|
10404
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
10405
10405
|
* @param initialRole - The role to assign to the user if they are being created.
|
|
10406
10406
|
* @returns The signed-in or newly created user.
|
|
10407
10407
|
*/
|
|
10408
|
-
async signInWithGoogleAuthCode(authorizationCode, redirectUri,
|
|
10408
|
+
async signInWithGoogleAuthCode(authorizationCode, redirectUri, clientId, initialRole = "patient" /* PATIENT */) {
|
|
10409
10409
|
try {
|
|
10410
10410
|
console.log("[AUTH] Signing in with Google authorization code (native flow)");
|
|
10411
|
-
console.log("[AUTH] Platform:", platform);
|
|
10412
10411
|
console.log("[AUTH] Redirect URI:", redirectUri);
|
|
10413
10412
|
console.log("[AUTH] Code length:", authorizationCode.length);
|
|
10414
|
-
const clientId = platform === "ios" ? process.env.GOOGLE_IOS_CLIENT_ID : process.env.GOOGLE_ANDROID_CLIENT_ID;
|
|
10415
10413
|
if (!clientId) {
|
|
10416
|
-
throw new Error(
|
|
10417
|
-
`Missing Google ${platform.toUpperCase()} client ID in environment variables`
|
|
10418
|
-
);
|
|
10414
|
+
throw new Error("Google client ID is required for authorization code exchange");
|
|
10419
10415
|
}
|
|
10420
10416
|
console.log("[AUTH] Using client ID:", `${clientId.substring(0, 20)}...`);
|
|
10421
10417
|
const tokenEndpoint = "https://oauth2.googleapis.com/token";
|
|
@@ -10500,20 +10496,16 @@ var AuthService = class extends BaseService {
|
|
|
10500
10496
|
* with the platform-specific client ID, then links the Google account to the current user.
|
|
10501
10497
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
10502
10498
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
10503
|
-
* @param
|
|
10499
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
10504
10500
|
* @returns The updated user profile.
|
|
10505
10501
|
*/
|
|
10506
|
-
async linkGoogleAccountWithAuthCode(authorizationCode, redirectUri,
|
|
10502
|
+
async linkGoogleAccountWithAuthCode(authorizationCode, redirectUri, clientId) {
|
|
10507
10503
|
try {
|
|
10508
10504
|
console.log("[AUTH] Linking Google account with authorization code (native flow)");
|
|
10509
|
-
console.log("[AUTH] Platform:", platform);
|
|
10510
10505
|
console.log("[AUTH] Redirect URI:", redirectUri);
|
|
10511
10506
|
console.log("[AUTH] Code length:", authorizationCode.length);
|
|
10512
|
-
const clientId = platform === "ios" ? process.env.GOOGLE_IOS_CLIENT_ID : process.env.GOOGLE_ANDROID_CLIENT_ID;
|
|
10513
10507
|
if (!clientId) {
|
|
10514
|
-
throw new Error(
|
|
10515
|
-
`Missing Google ${platform.toUpperCase()} client ID in environment variables`
|
|
10516
|
-
);
|
|
10508
|
+
throw new Error("Google client ID is required for authorization code exchange");
|
|
10517
10509
|
}
|
|
10518
10510
|
console.log("[AUTH] Using client ID:", `${clientId.substring(0, 20)}...`);
|
|
10519
10511
|
const tokenEndpoint = "https://oauth2.googleapis.com/token";
|
package/dist/index.mjs
CHANGED
|
@@ -10505,21 +10505,17 @@ var AuthService = class extends BaseService {
|
|
|
10505
10505
|
* with the platform-specific client ID (no client secret needed for native apps).
|
|
10506
10506
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
10507
10507
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
10508
|
-
* @param
|
|
10508
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
10509
10509
|
* @param initialRole - The role to assign to the user if they are being created.
|
|
10510
10510
|
* @returns The signed-in or newly created user.
|
|
10511
10511
|
*/
|
|
10512
|
-
async signInWithGoogleAuthCode(authorizationCode, redirectUri,
|
|
10512
|
+
async signInWithGoogleAuthCode(authorizationCode, redirectUri, clientId, initialRole = "patient" /* PATIENT */) {
|
|
10513
10513
|
try {
|
|
10514
10514
|
console.log("[AUTH] Signing in with Google authorization code (native flow)");
|
|
10515
|
-
console.log("[AUTH] Platform:", platform);
|
|
10516
10515
|
console.log("[AUTH] Redirect URI:", redirectUri);
|
|
10517
10516
|
console.log("[AUTH] Code length:", authorizationCode.length);
|
|
10518
|
-
const clientId = platform === "ios" ? process.env.GOOGLE_IOS_CLIENT_ID : process.env.GOOGLE_ANDROID_CLIENT_ID;
|
|
10519
10517
|
if (!clientId) {
|
|
10520
|
-
throw new Error(
|
|
10521
|
-
`Missing Google ${platform.toUpperCase()} client ID in environment variables`
|
|
10522
|
-
);
|
|
10518
|
+
throw new Error("Google client ID is required for authorization code exchange");
|
|
10523
10519
|
}
|
|
10524
10520
|
console.log("[AUTH] Using client ID:", `${clientId.substring(0, 20)}...`);
|
|
10525
10521
|
const tokenEndpoint = "https://oauth2.googleapis.com/token";
|
|
@@ -10604,20 +10600,16 @@ var AuthService = class extends BaseService {
|
|
|
10604
10600
|
* with the platform-specific client ID, then links the Google account to the current user.
|
|
10605
10601
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
10606
10602
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
10607
|
-
* @param
|
|
10603
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
10608
10604
|
* @returns The updated user profile.
|
|
10609
10605
|
*/
|
|
10610
|
-
async linkGoogleAccountWithAuthCode(authorizationCode, redirectUri,
|
|
10606
|
+
async linkGoogleAccountWithAuthCode(authorizationCode, redirectUri, clientId) {
|
|
10611
10607
|
try {
|
|
10612
10608
|
console.log("[AUTH] Linking Google account with authorization code (native flow)");
|
|
10613
|
-
console.log("[AUTH] Platform:", platform);
|
|
10614
10609
|
console.log("[AUTH] Redirect URI:", redirectUri);
|
|
10615
10610
|
console.log("[AUTH] Code length:", authorizationCode.length);
|
|
10616
|
-
const clientId = platform === "ios" ? process.env.GOOGLE_IOS_CLIENT_ID : process.env.GOOGLE_ANDROID_CLIENT_ID;
|
|
10617
10611
|
if (!clientId) {
|
|
10618
|
-
throw new Error(
|
|
10619
|
-
`Missing Google ${platform.toUpperCase()} client ID in environment variables`
|
|
10620
|
-
);
|
|
10612
|
+
throw new Error("Google client ID is required for authorization code exchange");
|
|
10621
10613
|
}
|
|
10622
10614
|
console.log("[AUTH] Using client ID:", `${clientId.substring(0, 20)}...`);
|
|
10623
10615
|
const tokenEndpoint = "https://oauth2.googleapis.com/token";
|
package/package.json
CHANGED
|
@@ -909,33 +909,23 @@ export class AuthService extends BaseService {
|
|
|
909
909
|
* with the platform-specific client ID (no client secret needed for native apps).
|
|
910
910
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
911
911
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
912
|
-
* @param
|
|
912
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
913
913
|
* @param initialRole - The role to assign to the user if they are being created.
|
|
914
914
|
* @returns The signed-in or newly created user.
|
|
915
915
|
*/
|
|
916
916
|
async signInWithGoogleAuthCode(
|
|
917
917
|
authorizationCode: string,
|
|
918
918
|
redirectUri: string,
|
|
919
|
-
|
|
919
|
+
clientId: string,
|
|
920
920
|
initialRole: UserRole = UserRole.PATIENT,
|
|
921
921
|
): Promise<User> {
|
|
922
922
|
try {
|
|
923
923
|
console.log('[AUTH] Signing in with Google authorization code (native flow)');
|
|
924
|
-
console.log('[AUTH] Platform:', platform);
|
|
925
924
|
console.log('[AUTH] Redirect URI:', redirectUri);
|
|
926
925
|
console.log('[AUTH] Code length:', authorizationCode.length);
|
|
927
926
|
|
|
928
|
-
// Get the platform-specific client ID from environment variables
|
|
929
|
-
// These should be the same client IDs used in the mobile app
|
|
930
|
-
const clientId =
|
|
931
|
-
platform === 'ios'
|
|
932
|
-
? process.env.GOOGLE_IOS_CLIENT_ID
|
|
933
|
-
: process.env.GOOGLE_ANDROID_CLIENT_ID;
|
|
934
|
-
|
|
935
927
|
if (!clientId) {
|
|
936
|
-
throw new Error(
|
|
937
|
-
`Missing Google ${platform.toUpperCase()} client ID in environment variables`,
|
|
938
|
-
);
|
|
928
|
+
throw new Error('Google client ID is required for authorization code exchange');
|
|
939
929
|
}
|
|
940
930
|
|
|
941
931
|
console.log('[AUTH] Using client ID:', `${clientId.substring(0, 20)}...`);
|
|
@@ -1040,30 +1030,21 @@ export class AuthService extends BaseService {
|
|
|
1040
1030
|
* with the platform-specific client ID, then links the Google account to the current user.
|
|
1041
1031
|
* @param authorizationCode - The Google authorization code obtained from the mobile app.
|
|
1042
1032
|
* @param redirectUri - The redirect URI used in the OAuth flow.
|
|
1043
|
-
* @param
|
|
1033
|
+
* @param clientId - The platform-specific Google OAuth client ID.
|
|
1044
1034
|
* @returns The updated user profile.
|
|
1045
1035
|
*/
|
|
1046
1036
|
async linkGoogleAccountWithAuthCode(
|
|
1047
1037
|
authorizationCode: string,
|
|
1048
1038
|
redirectUri: string,
|
|
1049
|
-
|
|
1039
|
+
clientId: string,
|
|
1050
1040
|
): Promise<User> {
|
|
1051
1041
|
try {
|
|
1052
1042
|
console.log('[AUTH] Linking Google account with authorization code (native flow)');
|
|
1053
|
-
console.log('[AUTH] Platform:', platform);
|
|
1054
1043
|
console.log('[AUTH] Redirect URI:', redirectUri);
|
|
1055
1044
|
console.log('[AUTH] Code length:', authorizationCode.length);
|
|
1056
1045
|
|
|
1057
|
-
// Get the platform-specific client ID from environment variables
|
|
1058
|
-
const clientId =
|
|
1059
|
-
platform === 'ios'
|
|
1060
|
-
? process.env.GOOGLE_IOS_CLIENT_ID
|
|
1061
|
-
: process.env.GOOGLE_ANDROID_CLIENT_ID;
|
|
1062
|
-
|
|
1063
1046
|
if (!clientId) {
|
|
1064
|
-
throw new Error(
|
|
1065
|
-
`Missing Google ${platform.toUpperCase()} client ID in environment variables`,
|
|
1066
|
-
);
|
|
1047
|
+
throw new Error('Google client ID is required for authorization code exchange');
|
|
1067
1048
|
}
|
|
1068
1049
|
|
|
1069
1050
|
console.log('[AUTH] Using client ID:', `${clientId.substring(0, 20)}...`);
|