@nauth-toolkit/social-facebook 0.1.14 → 0.1.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/nestjs/facebook-social-auth.module.d.ts +37 -0
- package/dist/nestjs/facebook-social-auth.module.d.ts.map +1 -1
- package/dist/nestjs/facebook-social-auth.module.js +48 -4
- package/dist/nestjs/facebook-social-auth.module.js.map +1 -1
- package/dist/nestjs/index.d.ts +5 -0
- package/dist/nestjs/index.d.ts.map +1 -1
- package/dist/nestjs/index.js +6 -0
- package/dist/nestjs/index.js.map +1 -1
- package/dist/src/dto/social-login.dto.d.ts +219 -0
- package/dist/src/dto/social-login.dto.d.ts.map +1 -1
- package/dist/src/dto/social-login.dto.js +219 -0
- package/dist/src/dto/social-login.dto.js.map +1 -1
- package/dist/src/facebook-oauth.client.d.ts +59 -0
- package/dist/src/facebook-oauth.client.d.ts.map +1 -1
- package/dist/src/facebook-oauth.client.js +66 -2
- package/dist/src/facebook-oauth.client.js.map +1 -1
- package/dist/src/facebook-social-auth.service.d.ts +59 -1
- package/dist/src/facebook-social-auth.service.d.ts.map +1 -1
- package/dist/src/facebook-social-auth.service.js +82 -3
- package/dist/src/facebook-social-auth.service.js.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/token-verifier.service.d.ts +40 -0
- package/dist/src/token-verifier.service.d.ts.map +1 -1
- package/dist/src/token-verifier.service.js +44 -0
- package/dist/src/token-verifier.service.js.map +1 -1
- package/dist/src/verified-token-profile.interface.d.ts +21 -0
- package/dist/src/verified-token-profile.interface.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,10 +1,47 @@
|
|
|
1
1
|
import { OnModuleInit } from '@nestjs/common';
|
|
2
2
|
import { FacebookSocialAuthService } from '../src/facebook-social-auth.service';
|
|
3
3
|
import { SocialProviderRegistry } from '@nauth-toolkit/core/internal';
|
|
4
|
+
/**
|
|
5
|
+
* Facebook Social Authentication Module (NestJS Adapter)
|
|
6
|
+
*
|
|
7
|
+
* Provides Facebook OAuth integration for nauth-toolkit in NestJS applications.
|
|
8
|
+
* Automatically registers itself with SocialAuthService when imported.
|
|
9
|
+
*
|
|
10
|
+
* **Usage:**
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { AuthModule } from '@nauth-toolkit/nestjs';
|
|
13
|
+
* import { FacebookSocialAuthModule } from '@nauth-toolkit/social-facebook/nestjs';
|
|
14
|
+
*
|
|
15
|
+
* @Module({
|
|
16
|
+
* imports: [
|
|
17
|
+
* AuthModule.forRoot(config),
|
|
18
|
+
* FacebookSocialAuthModule, // 👈 Auto-registers with SocialAuthService
|
|
19
|
+
* ],
|
|
20
|
+
* })
|
|
21
|
+
* export class AppModule {}
|
|
22
|
+
*
|
|
23
|
+
* // Use via registry (recommended for dynamic access)
|
|
24
|
+
* constructor(private socialAuthService: SocialAuthService) {}
|
|
25
|
+
*
|
|
26
|
+
* @Get('social/facebook')
|
|
27
|
+
* async getFacebookAuthUrl() {
|
|
28
|
+
* const facebookProvider = this.socialAuthService.getProvider('facebook');
|
|
29
|
+
* const authUrl = await facebookProvider.getAuthUrl();
|
|
30
|
+
* return { authUrl };
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* // Or inject directly
|
|
34
|
+
* constructor(private facebookAuth: FacebookSocialAuthService) {}
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
4
37
|
export declare class FacebookSocialAuthModule implements OnModuleInit {
|
|
5
38
|
private readonly facebookSocialAuthService;
|
|
6
39
|
private readonly providerRegistry;
|
|
7
40
|
constructor(facebookSocialAuthService: FacebookSocialAuthService, providerRegistry: SocialProviderRegistry);
|
|
41
|
+
/**
|
|
42
|
+
* Auto-register Facebook provider with the SocialProviderRegistry
|
|
43
|
+
* when the module is initialized (only if enabled in config).
|
|
44
|
+
*/
|
|
8
45
|
onModuleInit(): void;
|
|
9
46
|
}
|
|
10
47
|
//# sourceMappingURL=facebook-social-auth.module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facebook-social-auth.module.d.ts","sourceRoot":"","sources":["../../nestjs/facebook-social-auth.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAYhF,OAAO,EAIL,sBAAsB,EAGvB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"facebook-social-auth.module.d.ts","sourceRoot":"","sources":["../../nestjs/facebook-social-auth.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAYhF,OAAO,EAIL,sBAAsB,EAGvB,MAAM,8BAA8B,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAmEa,wBAAyB,YAAW,YAAY;IAEzD,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAC1C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,yBAAyB,EAAE,yBAAyB,EACpD,gBAAgB,EAAE,sBAAsB;IAG3D;;;OAGG;IACH,YAAY,IAAI,IAAI;CAOrB"}
|
|
@@ -12,9 +12,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.FacebookSocialAuthModule = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const facebook_social_auth_service_1 = require("../src/facebook-social-auth.service");
|
|
15
|
+
// Public API imports
|
|
15
16
|
const core_1 = require("@nauth-toolkit/core");
|
|
17
|
+
// Internal API imports (for provider implementations)
|
|
16
18
|
const internal_1 = require("@nauth-toolkit/core/internal");
|
|
17
19
|
const token_verifier_service_1 = require("../src/token-verifier.service");
|
|
20
|
+
/**
|
|
21
|
+
* Facebook Social Authentication Module (NestJS Adapter)
|
|
22
|
+
*
|
|
23
|
+
* Provides Facebook OAuth integration for nauth-toolkit in NestJS applications.
|
|
24
|
+
* Automatically registers itself with SocialAuthService when imported.
|
|
25
|
+
*
|
|
26
|
+
* **Usage:**
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { AuthModule } from '@nauth-toolkit/nestjs';
|
|
29
|
+
* import { FacebookSocialAuthModule } from '@nauth-toolkit/social-facebook/nestjs';
|
|
30
|
+
*
|
|
31
|
+
* @Module({
|
|
32
|
+
* imports: [
|
|
33
|
+
* AuthModule.forRoot(config),
|
|
34
|
+
* FacebookSocialAuthModule, // 👈 Auto-registers with SocialAuthService
|
|
35
|
+
* ],
|
|
36
|
+
* })
|
|
37
|
+
* export class AppModule {}
|
|
38
|
+
*
|
|
39
|
+
* // Use via registry (recommended for dynamic access)
|
|
40
|
+
* constructor(private socialAuthService: SocialAuthService) {}
|
|
41
|
+
*
|
|
42
|
+
* @Get('social/facebook')
|
|
43
|
+
* async getFacebookAuthUrl() {
|
|
44
|
+
* const facebookProvider = this.socialAuthService.getProvider('facebook');
|
|
45
|
+
* const authUrl = await facebookProvider.getAuthUrl();
|
|
46
|
+
* return { authUrl };
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* // Or inject directly
|
|
50
|
+
* constructor(private facebookAuth: FacebookSocialAuthService) {}
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
18
53
|
let FacebookSocialAuthModule = class FacebookSocialAuthModule {
|
|
19
54
|
facebookSocialAuthService;
|
|
20
55
|
providerRegistry;
|
|
@@ -22,8 +57,12 @@ let FacebookSocialAuthModule = class FacebookSocialAuthModule {
|
|
|
22
57
|
this.facebookSocialAuthService = facebookSocialAuthService;
|
|
23
58
|
this.providerRegistry = providerRegistry;
|
|
24
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Auto-register Facebook provider with the SocialProviderRegistry
|
|
62
|
+
* when the module is initialized (only if enabled in config).
|
|
63
|
+
*/
|
|
25
64
|
onModuleInit() {
|
|
26
|
-
const config = this.facebookSocialAuthService['config'];
|
|
65
|
+
const config = this.facebookSocialAuthService['config']; // Access protected config
|
|
27
66
|
const providerConfig = config.social?.facebook;
|
|
28
67
|
if (providerConfig?.enabled) {
|
|
29
68
|
this.providerRegistry.registerProvider(this.facebookSocialAuthService);
|
|
@@ -33,7 +72,9 @@ let FacebookSocialAuthModule = class FacebookSocialAuthModule {
|
|
|
33
72
|
exports.FacebookSocialAuthModule = FacebookSocialAuthModule;
|
|
34
73
|
exports.FacebookSocialAuthModule = FacebookSocialAuthModule = __decorate([
|
|
35
74
|
(0, common_1.Module)({
|
|
75
|
+
// No imports needed - AuthModule is @Global() so its providers are available
|
|
36
76
|
providers: [
|
|
77
|
+
// Token verifier for Facebook access tokens
|
|
37
78
|
{
|
|
38
79
|
provide: 'FACEBOOK_TOKEN_VERIFIER',
|
|
39
80
|
useFactory: (config) => {
|
|
@@ -41,9 +82,12 @@ exports.FacebookSocialAuthModule = FacebookSocialAuthModule = __decorate([
|
|
|
41
82
|
},
|
|
42
83
|
inject: ['NAUTH_CONFIG'],
|
|
43
84
|
},
|
|
85
|
+
// Facebook Social Auth Service (factory provider)
|
|
44
86
|
{
|
|
45
87
|
provide: facebook_social_auth_service_1.FacebookSocialAuthService,
|
|
46
|
-
useFactory: (config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService,
|
|
88
|
+
useFactory: (config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, // Optional - only available when auditLogs.enabled is true
|
|
89
|
+
trustedDeviceService, // Optional - only available when rememberDevices is enabled
|
|
90
|
+
tokenVerifier) => {
|
|
47
91
|
return new facebook_social_auth_service_1.FacebookSocialAuthService(config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, trustedDeviceService, tokenVerifier);
|
|
48
92
|
},
|
|
49
93
|
inject: [
|
|
@@ -58,8 +102,8 @@ exports.FacebookSocialAuthModule = FacebookSocialAuthModule = __decorate([
|
|
|
58
102
|
'SOCIAL_AUTH_STATE_STORE',
|
|
59
103
|
'UserRepository',
|
|
60
104
|
{ token: core_1.PhoneVerificationService, optional: true },
|
|
61
|
-
{ token: internal_1.AuthAuditService, optional: true },
|
|
62
|
-
{ token: internal_1.TrustedDeviceService, optional: true },
|
|
105
|
+
{ token: internal_1.AuthAuditService, optional: true }, // Optional - only available when auditLogs.enabled is true
|
|
106
|
+
{ token: internal_1.TrustedDeviceService, optional: true }, // Optional - only available when rememberDevices is enabled
|
|
63
107
|
{ token: 'FACEBOOK_TOKEN_VERIFIER', optional: true },
|
|
64
108
|
],
|
|
65
109
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facebook-social-auth.module.js","sourceRoot":"","sources":["../../nestjs/facebook-social-auth.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsD;AACtD,sFAAgF;
|
|
1
|
+
{"version":3,"file":"facebook-social-auth.module.js","sourceRoot":"","sources":["../../nestjs/facebook-social-auth.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsD;AACtD,sFAAgF;AAChF,qBAAqB;AACrB,8CAQ6B;AAC7B,sDAAsD;AACtD,2DAOsC;AACtC,0EAAqG;AAErG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAoEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEhB;IACA;IAFnB,YACmB,yBAAoD,EACpD,gBAAwC;QADxC,8BAAyB,GAAzB,yBAAyB,CAA2B;QACpD,qBAAgB,GAAhB,gBAAgB,CAAwB;IACxD,CAAC;IAEJ;;;OAGG;IACH,YAAY;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,yBAAyB,CAAC,QAAQ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AK,EAAE,+BAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACnD,EAAE,KAAK,EAAE,2BAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,2DAA2D;oBAChH,EAAE,KAAK,EAAE,+BAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,4DAA4D;oBAC7G,EAAE,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,IAAI,EAAE;iBACrD;aACF;SACF;QACD,OAAO,EAAE,CAAC,wDAAyB,CAAC;KACrC,CAAC;qCAG8C,wDAAyB;QAClC,iCAAsB;GAHhD,wBAAwB,CAiBpC"}
|
package/dist/nestjs/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nauth-toolkit/social-facebook/nestjs
|
|
3
|
+
*
|
|
4
|
+
* NestJS adapter for Facebook Social Authentication
|
|
5
|
+
*/
|
|
1
6
|
export { FacebookSocialAuthModule } from './facebook-social-auth.module';
|
|
2
7
|
export * from '../src/facebook-social-auth.service';
|
|
3
8
|
export * from '../src/facebook-oauth.client';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,6BAA6B,CAAC"}
|
package/dist/nestjs/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @nauth-toolkit/social-facebook/nestjs
|
|
4
|
+
*
|
|
5
|
+
* NestJS adapter for Facebook Social Authentication
|
|
6
|
+
*/
|
|
2
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
8
|
if (k2 === undefined) k2 = k;
|
|
4
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -17,6 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
22
|
exports.FacebookSocialAuthModule = void 0;
|
|
18
23
|
var facebook_social_auth_module_1 = require("./facebook-social-auth.module");
|
|
19
24
|
Object.defineProperty(exports, "FacebookSocialAuthModule", { enumerable: true, get: function () { return facebook_social_auth_module_1.FacebookSocialAuthModule; } });
|
|
25
|
+
// Re-export core Facebook social auth components
|
|
20
26
|
__exportStar(require("../src/facebook-social-auth.service"), exports);
|
|
21
27
|
__exportStar(require("../src/facebook-oauth.client"), exports);
|
|
22
28
|
__exportStar(require("../src/token-verifier.service"), exports);
|
package/dist/nestjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AAEjC,iDAAiD;AACjD,sEAAoD;AACpD,+DAA6C;AAC7C,gEAA8C;AAC9C,0EAAwD;AACxD,8DAA4C"}
|
|
@@ -1,32 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Social provider enum
|
|
3
|
+
*/
|
|
1
4
|
export declare enum SocialProvider {
|
|
2
5
|
GOOGLE = "google",
|
|
3
6
|
APPLE = "apple",
|
|
4
7
|
FACEBOOK = "facebook"
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* DTO for initiating social login
|
|
11
|
+
* Used to generate OAuth URLs for social providers
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Generate Google OAuth URL
|
|
16
|
+
* const dto = new SocialLoginDTO();
|
|
17
|
+
* dto.provider = 'google';
|
|
18
|
+
* dto.state = 'random-state-string';
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
6
21
|
export declare class SocialLoginDTO {
|
|
22
|
+
/**
|
|
23
|
+
* Social provider name
|
|
24
|
+
* Must be one of the configured providers
|
|
25
|
+
*
|
|
26
|
+
* Validation:
|
|
27
|
+
* - Must be a valid SocialProvider enum value
|
|
28
|
+
*/
|
|
7
29
|
provider: SocialProvider;
|
|
30
|
+
/**
|
|
31
|
+
* Optional state parameter for OAuth flow
|
|
32
|
+
* Used to prevent CSRF attacks and maintain state
|
|
33
|
+
* If not provided, a random state will be generated
|
|
34
|
+
*
|
|
35
|
+
* Validation:
|
|
36
|
+
* - Must be a string if present
|
|
37
|
+
* - Max 2000 characters (typical OAuth state length)
|
|
38
|
+
*/
|
|
8
39
|
state?: string;
|
|
9
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* DTO for handling OAuth callback
|
|
43
|
+
* Used to process the authorization code from OAuth providers
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* // Handle Google OAuth callback
|
|
48
|
+
* const dto = new SocialCallbackDTO();
|
|
49
|
+
* dto.provider = 'google';
|
|
50
|
+
* dto.code = 'authorization-code-from-google';
|
|
51
|
+
* dto.state = 'state-from-initial-request';
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
10
54
|
export declare class SocialCallbackDTO {
|
|
55
|
+
/**
|
|
56
|
+
* Social provider name
|
|
57
|
+
* Must match the provider used in the initial request
|
|
58
|
+
*
|
|
59
|
+
* Validation:
|
|
60
|
+
* - Must be a valid SocialProvider enum value
|
|
61
|
+
*/
|
|
11
62
|
provider: SocialProvider;
|
|
63
|
+
/**
|
|
64
|
+
* Authorization code from OAuth provider
|
|
65
|
+
* This code is exchanged for access token and user info
|
|
66
|
+
*
|
|
67
|
+
* Validation:
|
|
68
|
+
* - Must be a string
|
|
69
|
+
* - Max 1000 characters (typical OAuth code length)
|
|
70
|
+
*/
|
|
12
71
|
code: string;
|
|
72
|
+
/**
|
|
73
|
+
* State parameter from OAuth flow
|
|
74
|
+
* Must match the state sent in the initial request
|
|
75
|
+
*
|
|
76
|
+
* Validation:
|
|
77
|
+
* - Must be a string
|
|
78
|
+
* - Max 500 characters (typical OAuth state length)
|
|
79
|
+
*/
|
|
13
80
|
state: string;
|
|
81
|
+
/**
|
|
82
|
+
* Optional error parameter from OAuth provider
|
|
83
|
+
* Used when user denies permission or other errors occur
|
|
84
|
+
*
|
|
85
|
+
* Validation:
|
|
86
|
+
* - Must be a string if present
|
|
87
|
+
* - Max 100 characters
|
|
88
|
+
*/
|
|
14
89
|
error?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Optional error description from OAuth provider
|
|
92
|
+
* Provides more details about the error
|
|
93
|
+
*
|
|
94
|
+
* Validation:
|
|
95
|
+
* - Must be a string if present
|
|
96
|
+
* - Max 500 characters
|
|
97
|
+
*/
|
|
15
98
|
error_description?: string;
|
|
16
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* DTO for linking social account to existing user
|
|
102
|
+
* Used when an authenticated user wants to link a social provider
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* // Link Google account to current user
|
|
107
|
+
* const dto = new LinkSocialAccountDTO();
|
|
108
|
+
* dto.provider = 'google';
|
|
109
|
+
* dto.code = 'authorization-code-from-google';
|
|
110
|
+
* dto.state = 'state-from-initial-request';
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
17
113
|
export declare class LinkSocialAccountDTO {
|
|
114
|
+
/**
|
|
115
|
+
* Social provider name
|
|
116
|
+
* Must be one of the configured providers
|
|
117
|
+
*
|
|
118
|
+
* Validation:
|
|
119
|
+
* - Must be a valid SocialProvider enum value
|
|
120
|
+
*/
|
|
18
121
|
provider: SocialProvider;
|
|
122
|
+
/**
|
|
123
|
+
* Authorization code from OAuth provider
|
|
124
|
+
* This code is exchanged for access token and user info
|
|
125
|
+
*
|
|
126
|
+
* Validation:
|
|
127
|
+
* - Must be a string
|
|
128
|
+
* - Max 1000 characters (typical OAuth code length)
|
|
129
|
+
*/
|
|
19
130
|
code: string;
|
|
131
|
+
/**
|
|
132
|
+
* State parameter from OAuth flow
|
|
133
|
+
* Must match the state sent in the initial request
|
|
134
|
+
*
|
|
135
|
+
* Validation:
|
|
136
|
+
* - Must be a string
|
|
137
|
+
* - Max 500 characters (typical OAuth state length)
|
|
138
|
+
*/
|
|
20
139
|
state: string;
|
|
21
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* DTO for unlinking social account
|
|
143
|
+
* Used when an authenticated user wants to remove a social provider
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* // Unlink Google account from current user
|
|
148
|
+
* const dto = new UnlinkSocialAccountDTO();
|
|
149
|
+
* dto.provider = 'google';
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
22
152
|
export declare class UnlinkSocialAccountDTO {
|
|
153
|
+
/**
|
|
154
|
+
* Social provider name to unlink
|
|
155
|
+
* Must be one of the currently linked providers
|
|
156
|
+
*
|
|
157
|
+
* Validation:
|
|
158
|
+
* - Must be a valid SocialProvider enum value
|
|
159
|
+
*/
|
|
23
160
|
provider: SocialProvider;
|
|
24
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Response DTO for social login
|
|
164
|
+
* Contains authentication tokens and user information
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* // Response after successful social login
|
|
169
|
+
* {
|
|
170
|
+
* "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
171
|
+
* "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
172
|
+
* "expiresIn": 900,
|
|
173
|
+
* "user": {
|
|
174
|
+
* "sub": "user-uuid",
|
|
175
|
+
* "email": "user@example.com",
|
|
176
|
+
* "firstName": "John",
|
|
177
|
+
* "lastName": "Doe",
|
|
178
|
+
* "isEmailVerified": true,
|
|
179
|
+
* "socialProviders": ["google"]
|
|
180
|
+
* }
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
25
184
|
export declare class SocialLoginResponseDTO {
|
|
185
|
+
/**
|
|
186
|
+
* JWT access token for API authentication
|
|
187
|
+
*
|
|
188
|
+
* Validation:
|
|
189
|
+
* - Must be a string
|
|
190
|
+
* - Max 2048 characters (typical JWT length)
|
|
191
|
+
*/
|
|
26
192
|
accessToken: string;
|
|
193
|
+
/**
|
|
194
|
+
* JWT refresh token for token renewal
|
|
195
|
+
*
|
|
196
|
+
* Validation:
|
|
197
|
+
* - Must be a string
|
|
198
|
+
* - Max 2048 characters (typical JWT length)
|
|
199
|
+
*/
|
|
27
200
|
refreshToken: string;
|
|
201
|
+
/**
|
|
202
|
+
* Access token expiration timestamp (Unix timestamp in seconds)
|
|
203
|
+
*
|
|
204
|
+
* Validation:
|
|
205
|
+
* - Must be a number
|
|
206
|
+
*/
|
|
28
207
|
accessTokenExpiresAt: number;
|
|
208
|
+
/**
|
|
209
|
+
* Refresh token expiration timestamp (Unix timestamp in seconds)
|
|
210
|
+
*
|
|
211
|
+
* Validation:
|
|
212
|
+
* - Must be a number
|
|
213
|
+
*/
|
|
29
214
|
refreshTokenExpiresAt: number;
|
|
215
|
+
/**
|
|
216
|
+
* User information
|
|
217
|
+
*
|
|
218
|
+
* Validation:
|
|
219
|
+
* - Nested fields validated in service layer:
|
|
220
|
+
* - sub: UUID v4 format, max 36 chars
|
|
221
|
+
* - email: Valid email format, max 255 chars
|
|
222
|
+
* - firstName: String, max 100 chars
|
|
223
|
+
* - lastName: String, max 100 chars
|
|
224
|
+
* - isEmailVerified: Boolean
|
|
225
|
+
* - socialProviders: Array of strings, each max 50 chars
|
|
226
|
+
*/
|
|
30
227
|
user: {
|
|
31
228
|
sub: string;
|
|
32
229
|
email: string;
|
|
@@ -36,7 +233,29 @@ export declare class SocialLoginResponseDTO {
|
|
|
36
233
|
socialProviders?: string[];
|
|
37
234
|
};
|
|
38
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Response DTO for social account information
|
|
238
|
+
* Contains details about linked social accounts
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* // Response for user's linked social accounts
|
|
243
|
+
* {
|
|
244
|
+
* "accounts": [
|
|
245
|
+
* {
|
|
246
|
+
* "provider": "google",
|
|
247
|
+
* "providerEmail": "user@gmail.com",
|
|
248
|
+
* "linkedAt": "2023-01-01T00:00:00Z",
|
|
249
|
+
* "lastUsedAt": "2023-01-15T12:00:00Z"
|
|
250
|
+
* }
|
|
251
|
+
* ]
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
39
255
|
export declare class SocialAccountsResponseDTO {
|
|
256
|
+
/**
|
|
257
|
+
* Array of linked social accounts
|
|
258
|
+
*/
|
|
40
259
|
accounts: Array<{
|
|
41
260
|
provider: string;
|
|
42
261
|
providerEmail?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-login.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/social-login.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"social-login.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/social-login.dto.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,cAAc;IACzB;;;;;;OAMG;IAEH,QAAQ,EAAG,cAAc,CAAC;IAE1B;;;;;;;;OAQG;IAIH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;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