@fonderie/client 0.22.0 → 0.23.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.
@@ -143,6 +143,7 @@ new AuthClient(http: HttpClient, tokens: TokenStore): AuthClient
143
143
  .mfa: MfaClient
144
144
  .setAccessToken(token: string | undefined): void
145
145
  .providers(): Promise<IApiResponse<IAuthProvidersResult>>
146
+ .unlinkOauth(provider: string): Promise<IApiResponse<null>>
146
147
  .register(input: IRegisterInput): Promise<IApiResponse<IRegisterResult>>
147
148
  .login(input: ILoginInput): Promise<IApiResponse<ILoginResult | IMfaRequiredResult>>
148
149
  .appleNative(input: IAppleNativeInput): Promise<IApiResponse<ILoginResult>>
@@ -1055,6 +1056,8 @@ interface IUserDTO {
1055
1056
  isEmailVerified: boolean;
1056
1057
  isPhoneVerified: boolean;
1057
1058
  mfaEnabled: boolean;
1059
+ provider: string;
1060
+ hasPassword: boolean;
1058
1061
  suspended: boolean;
1059
1062
  whitelist: boolean;
1060
1063
  ipWhitelist: string[];
package/dist/index.cjs CHANGED
@@ -295,6 +295,20 @@ var AuthClient = class {
295
295
  path: "/auth/providers"
296
296
  });
297
297
  }
298
+ /**
299
+ * Disconnect the OAuth provider linked to the signed-in account.
300
+ *
301
+ * Refused with 409 PASSWORD_REQUIRED when the account has no password:
302
+ * removing the only credential is account deletion, not a settings toggle.
303
+ * Check `user.hasPassword` before offering the control so the user is asked
304
+ * to set a password first rather than shown an error they can't act on.
305
+ */
306
+ unlinkOauth(provider) {
307
+ return this.http.request({
308
+ method: "DELETE",
309
+ path: `/auth/oauth/${encodeURIComponent(provider)}`
310
+ });
311
+ }
298
312
  register(input) {
299
313
  return this.http.request({
300
314
  method: "POST",