@drmhse/sso-sdk 0.4.0 → 0.5.0

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 CHANGED
@@ -519,6 +519,54 @@ interface Identity {
519
519
  interface StartLinkResponse {
520
520
  authorization_url: string;
521
521
  }
522
+ interface ProviderDefinition {
523
+ provider: string;
524
+ display_name: string;
525
+ provider_type: string;
526
+ scopes: string[];
527
+ connect_supported: boolean;
528
+ }
529
+ interface LinkedAccountGrant {
530
+ id: string;
531
+ service_id: string;
532
+ scopes: string[];
533
+ granted_at: string;
534
+ last_used_at?: string;
535
+ }
536
+ interface LinkedAccount {
537
+ id: string;
538
+ provider: string;
539
+ provider_user_id: string;
540
+ email?: string;
541
+ display_name?: string;
542
+ scopes: string[];
543
+ expires_at?: string;
544
+ status: string;
545
+ grants: LinkedAccountGrant[];
546
+ }
547
+ interface LinkedAccountsResponse {
548
+ accounts: LinkedAccount[];
549
+ available_providers: ProviderDefinition[];
550
+ }
551
+ interface GrantLinkedAccountRequest {
552
+ service_id?: string;
553
+ scopes: string[];
554
+ }
555
+ interface ProviderTokenRequestDetails {
556
+ state: string;
557
+ provider: string;
558
+ requested_scopes: string[];
559
+ service_id: string;
560
+ service_name: string;
561
+ expires_at: string;
562
+ accounts: LinkedAccount[];
563
+ }
564
+ interface CompleteProviderTokenRequestPayload {
565
+ connected_account_id?: string;
566
+ }
567
+ interface CompleteProviderTokenRequestResponse {
568
+ redirect_url: string;
569
+ }
522
570
  /**
523
571
  * Change password request payload
524
572
  */
@@ -1987,7 +2035,7 @@ interface UpdateRoleRequest {
1987
2035
  /**
1988
2036
  * Upstream Provider (Enterprise SSO) types
1989
2037
  */
1990
- type UpstreamProviderType = 'oidc' | 'saml';
2038
+ type UpstreamProviderType = 'oidc' | 'oauth2' | 'saml';
1991
2039
  interface UpstreamProvider {
1992
2040
  id: string;
1993
2041
  org_id: string;
@@ -2637,6 +2685,18 @@ declare class IdentitiesModule {
2637
2685
  */
2638
2686
  unlink(provider: string): Promise<void>;
2639
2687
  }
2688
+ declare class LinkedAccountsModule {
2689
+ private http;
2690
+ constructor(http: HttpClient);
2691
+ list(): Promise<LinkedAccountsResponse>;
2692
+ startLink(provider: string): Promise<StartLinkResponse>;
2693
+ grant(accountId: string, payload: GrantLinkedAccountRequest): Promise<LinkedAccountGrant>;
2694
+ revokeGrant(accountId: string, serviceId: string): Promise<void>;
2695
+ unlink(accountId: string): Promise<void>;
2696
+ getProviderTokenRequest(state: string): Promise<ProviderTokenRequestDetails>;
2697
+ completeProviderTokenRequest(state: string, payload?: CompleteProviderTokenRequestPayload): Promise<CompleteProviderTokenRequestResponse>;
2698
+ startProviderTokenRequestLink(state: string): Promise<StartLinkResponse>;
2699
+ }
2640
2700
  /**
2641
2701
  * Multi-Factor Authentication (MFA) methods
2642
2702
  */
@@ -2809,6 +2869,7 @@ declare class DevicesModule {
2809
2869
  declare class UserModule {
2810
2870
  private http;
2811
2871
  readonly identities: IdentitiesModule;
2872
+ readonly linkedAccounts: LinkedAccountsModule;
2812
2873
  readonly mfa: MfaModule;
2813
2874
  readonly devices: DevicesModule;
2814
2875
  constructor(http: HttpClient);
@@ -5065,6 +5126,33 @@ interface ServiceAnalytics {
5065
5126
  active_subscriptions: number;
5066
5127
  [key: string]: any;
5067
5128
  }
5129
+ interface ProviderTokenRequest {
5130
+ user_id: string;
5131
+ provider: string;
5132
+ scopes?: string[];
5133
+ redirect_uri?: string;
5134
+ state?: string;
5135
+ }
5136
+ interface ProviderTokenAccount {
5137
+ id: string;
5138
+ provider_user_id: string;
5139
+ email?: string;
5140
+ display_name?: string;
5141
+ }
5142
+ type ProviderTokenResult = {
5143
+ status: 'ok';
5144
+ access_token: string;
5145
+ expires_at?: string;
5146
+ scopes: string[];
5147
+ provider: string;
5148
+ account: ProviderTokenAccount;
5149
+ } | {
5150
+ status: 'action_required';
5151
+ code: 'PROVIDER_LINK_REQUIRED' | 'PROVIDER_GRANT_REQUIRED' | 'PROVIDER_SCOPE_CONSENT_REQUIRED' | 'PROVIDER_REAUTH_REQUIRED' | string;
5152
+ reauth_url: string;
5153
+ missing_scopes: string[];
5154
+ provider: string;
5155
+ };
5068
5156
  /**
5069
5157
  * Service API module for API key-based service-to-service operations.
5070
5158
  * Provides operations for managing users, subscriptions, and service configuration.
@@ -5148,6 +5236,11 @@ declare class ServiceApiModule {
5148
5236
  * @returns Service information
5149
5237
  */
5150
5238
  getServiceInfo(): Promise<ServiceApiInfo>;
5239
+ /**
5240
+ * Request a backend-only third-party provider access token for an AuthOS user.
5241
+ * Requires `read:provider_tokens` or `read:provider_tokens:{provider}` on the API key.
5242
+ */
5243
+ requestProviderToken(request: ProviderTokenRequest): Promise<ProviderTokenResult>;
5151
5244
  /**
5152
5245
  * Create a new user
5153
5246
  * Requires 'write:users' permission on the API key
@@ -5994,4 +6087,4 @@ declare class SsoApiError extends Error {
5994
6087
  isNotFound(): boolean;
5995
6088
  }
5996
6089
 
5997
- export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, type AuthContextRequest, type AuthContextResponse, AuthErrorCodes, AuthModule, type AuthOrganizationContext, type AuthServiceContext, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateRoleRequest, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateUpstreamProviderPayload, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserLoginEvent, type EndUserSession, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserRequest, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeoLocation, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type MemberServiceAccess, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyActionResponse, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PlatformUser, type PlatformUserListResponse, type PromotePlatformOwnerPayload, type ProviderToken, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type RoleResponse, type RotateServiceSecretResponse, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateMemberServiceAccessPayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateRoleRequest, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUpstreamProviderPayload, type UpdateUserProfilePayload, type UpdateWebhookRequest, type UpstreamProvider, type UpstreamProviderType, type User, type UserDevice, UserModule, type UserPasskey, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
6090
+ export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, type AuthContextRequest, type AuthContextResponse, AuthErrorCodes, AuthModule, type AuthOrganizationContext, type AuthServiceContext, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type CompleteProviderTokenRequestPayload, type CompleteProviderTokenRequestResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateRoleRequest, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateUpstreamProviderPayload, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserLoginEvent, type EndUserSession, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserRequest, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeoLocation, type GetAuditLogParams, type GetRiskSettingsResponse, type GrantLinkedAccountRequest, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type LinkedAccount, type LinkedAccountGrant, type LinkedAccountsResponse, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type MemberServiceAccess, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyActionResponse, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PlatformUser, type PlatformUserListResponse, type PromotePlatformOwnerPayload, type ProviderDefinition, type ProviderToken, type ProviderTokenRequestDetails, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type RoleResponse, type RotateServiceSecretResponse, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateMemberServiceAccessPayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateRoleRequest, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUpstreamProviderPayload, type UpdateUserProfilePayload, type UpdateWebhookRequest, type UpstreamProvider, type UpstreamProviderType, type User, type UserDevice, UserModule, type UserPasskey, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
package/dist/index.d.ts CHANGED
@@ -519,6 +519,54 @@ interface Identity {
519
519
  interface StartLinkResponse {
520
520
  authorization_url: string;
521
521
  }
522
+ interface ProviderDefinition {
523
+ provider: string;
524
+ display_name: string;
525
+ provider_type: string;
526
+ scopes: string[];
527
+ connect_supported: boolean;
528
+ }
529
+ interface LinkedAccountGrant {
530
+ id: string;
531
+ service_id: string;
532
+ scopes: string[];
533
+ granted_at: string;
534
+ last_used_at?: string;
535
+ }
536
+ interface LinkedAccount {
537
+ id: string;
538
+ provider: string;
539
+ provider_user_id: string;
540
+ email?: string;
541
+ display_name?: string;
542
+ scopes: string[];
543
+ expires_at?: string;
544
+ status: string;
545
+ grants: LinkedAccountGrant[];
546
+ }
547
+ interface LinkedAccountsResponse {
548
+ accounts: LinkedAccount[];
549
+ available_providers: ProviderDefinition[];
550
+ }
551
+ interface GrantLinkedAccountRequest {
552
+ service_id?: string;
553
+ scopes: string[];
554
+ }
555
+ interface ProviderTokenRequestDetails {
556
+ state: string;
557
+ provider: string;
558
+ requested_scopes: string[];
559
+ service_id: string;
560
+ service_name: string;
561
+ expires_at: string;
562
+ accounts: LinkedAccount[];
563
+ }
564
+ interface CompleteProviderTokenRequestPayload {
565
+ connected_account_id?: string;
566
+ }
567
+ interface CompleteProviderTokenRequestResponse {
568
+ redirect_url: string;
569
+ }
522
570
  /**
523
571
  * Change password request payload
524
572
  */
@@ -1987,7 +2035,7 @@ interface UpdateRoleRequest {
1987
2035
  /**
1988
2036
  * Upstream Provider (Enterprise SSO) types
1989
2037
  */
1990
- type UpstreamProviderType = 'oidc' | 'saml';
2038
+ type UpstreamProviderType = 'oidc' | 'oauth2' | 'saml';
1991
2039
  interface UpstreamProvider {
1992
2040
  id: string;
1993
2041
  org_id: string;
@@ -2637,6 +2685,18 @@ declare class IdentitiesModule {
2637
2685
  */
2638
2686
  unlink(provider: string): Promise<void>;
2639
2687
  }
2688
+ declare class LinkedAccountsModule {
2689
+ private http;
2690
+ constructor(http: HttpClient);
2691
+ list(): Promise<LinkedAccountsResponse>;
2692
+ startLink(provider: string): Promise<StartLinkResponse>;
2693
+ grant(accountId: string, payload: GrantLinkedAccountRequest): Promise<LinkedAccountGrant>;
2694
+ revokeGrant(accountId: string, serviceId: string): Promise<void>;
2695
+ unlink(accountId: string): Promise<void>;
2696
+ getProviderTokenRequest(state: string): Promise<ProviderTokenRequestDetails>;
2697
+ completeProviderTokenRequest(state: string, payload?: CompleteProviderTokenRequestPayload): Promise<CompleteProviderTokenRequestResponse>;
2698
+ startProviderTokenRequestLink(state: string): Promise<StartLinkResponse>;
2699
+ }
2640
2700
  /**
2641
2701
  * Multi-Factor Authentication (MFA) methods
2642
2702
  */
@@ -2809,6 +2869,7 @@ declare class DevicesModule {
2809
2869
  declare class UserModule {
2810
2870
  private http;
2811
2871
  readonly identities: IdentitiesModule;
2872
+ readonly linkedAccounts: LinkedAccountsModule;
2812
2873
  readonly mfa: MfaModule;
2813
2874
  readonly devices: DevicesModule;
2814
2875
  constructor(http: HttpClient);
@@ -5065,6 +5126,33 @@ interface ServiceAnalytics {
5065
5126
  active_subscriptions: number;
5066
5127
  [key: string]: any;
5067
5128
  }
5129
+ interface ProviderTokenRequest {
5130
+ user_id: string;
5131
+ provider: string;
5132
+ scopes?: string[];
5133
+ redirect_uri?: string;
5134
+ state?: string;
5135
+ }
5136
+ interface ProviderTokenAccount {
5137
+ id: string;
5138
+ provider_user_id: string;
5139
+ email?: string;
5140
+ display_name?: string;
5141
+ }
5142
+ type ProviderTokenResult = {
5143
+ status: 'ok';
5144
+ access_token: string;
5145
+ expires_at?: string;
5146
+ scopes: string[];
5147
+ provider: string;
5148
+ account: ProviderTokenAccount;
5149
+ } | {
5150
+ status: 'action_required';
5151
+ code: 'PROVIDER_LINK_REQUIRED' | 'PROVIDER_GRANT_REQUIRED' | 'PROVIDER_SCOPE_CONSENT_REQUIRED' | 'PROVIDER_REAUTH_REQUIRED' | string;
5152
+ reauth_url: string;
5153
+ missing_scopes: string[];
5154
+ provider: string;
5155
+ };
5068
5156
  /**
5069
5157
  * Service API module for API key-based service-to-service operations.
5070
5158
  * Provides operations for managing users, subscriptions, and service configuration.
@@ -5148,6 +5236,11 @@ declare class ServiceApiModule {
5148
5236
  * @returns Service information
5149
5237
  */
5150
5238
  getServiceInfo(): Promise<ServiceApiInfo>;
5239
+ /**
5240
+ * Request a backend-only third-party provider access token for an AuthOS user.
5241
+ * Requires `read:provider_tokens` or `read:provider_tokens:{provider}` on the API key.
5242
+ */
5243
+ requestProviderToken(request: ProviderTokenRequest): Promise<ProviderTokenResult>;
5151
5244
  /**
5152
5245
  * Create a new user
5153
5246
  * Requires 'write:users' permission on the API key
@@ -5994,4 +6087,4 @@ declare class SsoApiError extends Error {
5994
6087
  isNotFound(): boolean;
5995
6088
  }
5996
6089
 
5997
- export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, type AuthContextRequest, type AuthContextResponse, AuthErrorCodes, AuthModule, type AuthOrganizationContext, type AuthServiceContext, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateRoleRequest, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateUpstreamProviderPayload, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserLoginEvent, type EndUserSession, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserRequest, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeoLocation, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type MemberServiceAccess, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyActionResponse, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PlatformUser, type PlatformUserListResponse, type PromotePlatformOwnerPayload, type ProviderToken, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type RoleResponse, type RotateServiceSecretResponse, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateMemberServiceAccessPayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateRoleRequest, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUpstreamProviderPayload, type UpdateUserProfilePayload, type UpdateWebhookRequest, type UpstreamProvider, type UpstreamProviderType, type User, type UserDevice, UserModule, type UserPasskey, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
6090
+ export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, type AuthContextRequest, type AuthContextResponse, AuthErrorCodes, AuthModule, type AuthOrganizationContext, type AuthServiceContext, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type CompleteProviderTokenRequestPayload, type CompleteProviderTokenRequestResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateRoleRequest, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateUpstreamProviderPayload, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserLoginEvent, type EndUserSession, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserRequest, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeoLocation, type GetAuditLogParams, type GetRiskSettingsResponse, type GrantLinkedAccountRequest, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type LinkedAccount, type LinkedAccountGrant, type LinkedAccountsResponse, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type MemberServiceAccess, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyActionResponse, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PlatformUser, type PlatformUserListResponse, type PromotePlatformOwnerPayload, type ProviderDefinition, type ProviderToken, type ProviderTokenRequestDetails, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type RoleResponse, type RotateServiceSecretResponse, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateMemberServiceAccessPayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateRoleRequest, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUpstreamProviderPayload, type UpdateUserProfilePayload, type UpdateWebhookRequest, type UpstreamProvider, type UpstreamProviderType, type User, type UserDevice, UserModule, type UserPasskey, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
package/dist/index.js CHANGED
@@ -1092,6 +1092,41 @@ var IdentitiesModule = class {
1092
1092
  await this.http.delete(`/api/user/identities/${provider}`);
1093
1093
  }
1094
1094
  };
1095
+ var LinkedAccountsModule = class {
1096
+ constructor(http) {
1097
+ this.http = http;
1098
+ }
1099
+ async list() {
1100
+ const response = await this.http.get("/api/user/linked-accounts");
1101
+ return response.data;
1102
+ }
1103
+ async startLink(provider) {
1104
+ const response = await this.http.post(`/api/user/linked-accounts/${provider}/link`, {});
1105
+ return response.data;
1106
+ }
1107
+ async grant(accountId, payload) {
1108
+ const response = await this.http.post(`/api/user/linked-accounts/${accountId}/grants`, payload);
1109
+ return response.data;
1110
+ }
1111
+ async revokeGrant(accountId, serviceId) {
1112
+ await this.http.delete(`/api/user/linked-accounts/${accountId}/grants/${serviceId}`);
1113
+ }
1114
+ async unlink(accountId) {
1115
+ await this.http.delete(`/api/user/linked-accounts/${accountId}`);
1116
+ }
1117
+ async getProviderTokenRequest(state) {
1118
+ const response = await this.http.get(`/api/user/provider-token-requests/${state}`);
1119
+ return response.data;
1120
+ }
1121
+ async completeProviderTokenRequest(state, payload = {}) {
1122
+ const response = await this.http.post(`/api/user/provider-token-requests/${state}/complete`, payload);
1123
+ return response.data;
1124
+ }
1125
+ async startProviderTokenRequestLink(state) {
1126
+ const response = await this.http.post(`/api/user/provider-token-requests/${state}/link`, {});
1127
+ return response.data;
1128
+ }
1129
+ };
1095
1130
  var MfaModule = class {
1096
1131
  constructor(http) {
1097
1132
  this.http = http;
@@ -1293,6 +1328,7 @@ var UserModule = class {
1293
1328
  constructor(http) {
1294
1329
  this.http = http;
1295
1330
  this.identities = new IdentitiesModule(http);
1331
+ this.linkedAccounts = new LinkedAccountsModule(http);
1296
1332
  this.mfa = new MfaModule(http);
1297
1333
  this.devices = new DevicesModule(http);
1298
1334
  }
@@ -4063,6 +4099,17 @@ var ServiceApiModule = class {
4063
4099
  const response = await this.http.get("/api/service/info");
4064
4100
  return response.data;
4065
4101
  }
4102
+ /**
4103
+ * Request a backend-only third-party provider access token for an AuthOS user.
4104
+ * Requires `read:provider_tokens` or `read:provider_tokens:{provider}` on the API key.
4105
+ */
4106
+ async requestProviderToken(request) {
4107
+ const response = await this.http.post("/api/service/provider-tokens", {
4108
+ ...request,
4109
+ scopes: request.scopes ?? []
4110
+ });
4111
+ return response.data;
4112
+ }
4066
4113
  /**
4067
4114
  * Create a new user
4068
4115
  * Requires 'write:users' permission on the API key
package/dist/index.mjs CHANGED
@@ -1051,6 +1051,41 @@ var IdentitiesModule = class {
1051
1051
  await this.http.delete(`/api/user/identities/${provider}`);
1052
1052
  }
1053
1053
  };
1054
+ var LinkedAccountsModule = class {
1055
+ constructor(http) {
1056
+ this.http = http;
1057
+ }
1058
+ async list() {
1059
+ const response = await this.http.get("/api/user/linked-accounts");
1060
+ return response.data;
1061
+ }
1062
+ async startLink(provider) {
1063
+ const response = await this.http.post(`/api/user/linked-accounts/${provider}/link`, {});
1064
+ return response.data;
1065
+ }
1066
+ async grant(accountId, payload) {
1067
+ const response = await this.http.post(`/api/user/linked-accounts/${accountId}/grants`, payload);
1068
+ return response.data;
1069
+ }
1070
+ async revokeGrant(accountId, serviceId) {
1071
+ await this.http.delete(`/api/user/linked-accounts/${accountId}/grants/${serviceId}`);
1072
+ }
1073
+ async unlink(accountId) {
1074
+ await this.http.delete(`/api/user/linked-accounts/${accountId}`);
1075
+ }
1076
+ async getProviderTokenRequest(state) {
1077
+ const response = await this.http.get(`/api/user/provider-token-requests/${state}`);
1078
+ return response.data;
1079
+ }
1080
+ async completeProviderTokenRequest(state, payload = {}) {
1081
+ const response = await this.http.post(`/api/user/provider-token-requests/${state}/complete`, payload);
1082
+ return response.data;
1083
+ }
1084
+ async startProviderTokenRequestLink(state) {
1085
+ const response = await this.http.post(`/api/user/provider-token-requests/${state}/link`, {});
1086
+ return response.data;
1087
+ }
1088
+ };
1054
1089
  var MfaModule = class {
1055
1090
  constructor(http) {
1056
1091
  this.http = http;
@@ -1252,6 +1287,7 @@ var UserModule = class {
1252
1287
  constructor(http) {
1253
1288
  this.http = http;
1254
1289
  this.identities = new IdentitiesModule(http);
1290
+ this.linkedAccounts = new LinkedAccountsModule(http);
1255
1291
  this.mfa = new MfaModule(http);
1256
1292
  this.devices = new DevicesModule(http);
1257
1293
  }
@@ -4022,6 +4058,17 @@ var ServiceApiModule = class {
4022
4058
  const response = await this.http.get("/api/service/info");
4023
4059
  return response.data;
4024
4060
  }
4061
+ /**
4062
+ * Request a backend-only third-party provider access token for an AuthOS user.
4063
+ * Requires `read:provider_tokens` or `read:provider_tokens:{provider}` on the API key.
4064
+ */
4065
+ async requestProviderToken(request) {
4066
+ const response = await this.http.post("/api/service/provider-tokens", {
4067
+ ...request,
4068
+ scopes: request.scopes ?? []
4069
+ });
4070
+ return response.data;
4071
+ }
4025
4072
  /**
4026
4073
  * Create a new user
4027
4074
  * Requires 'write:users' permission on the API key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drmhse/sso-sdk",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Zero-dependency TypeScript SDK for AuthOS, the multi-tenant authentication platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",