@proveanything/smartlinks 2.0.0-alpha.6 → 2.0.1

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.
@@ -54,6 +54,24 @@ export declare namespace authKit {
54
54
  function googleLogin(clientId: string, idToken: string, trustedDeviceToken?: string): Promise<AuthLoginResponse>;
55
55
  /** Google OAuth login via server-side authorization code (public). */
56
56
  function googleCodeLogin(clientId: string, code: string, redirectUri: string): Promise<AuthLoginResponse>;
57
+ /**
58
+ * Sign in with LinkedIn (OpenID Connect) via a server-side authorization code (public).
59
+ *
60
+ * LinkedIn has no client-side ID-token SDK, so this is always the authorization-code flow:
61
+ * redirect the browser to LinkedIn's authorize endpoint, then pass the returned one-time
62
+ * `code` (and the exact `redirectUri` used) here — the server exchanges it (with the app's
63
+ * client secret) and verifies the id_token. Mirrors {@link googleCodeLogin}: on success the
64
+ * bearer token is stored and the cache invalidated.
65
+ *
66
+ * Notable error codes (thrown as `SmartlinksApiError`, read via `err.errorCode`):
67
+ * - `MISSING_LINKEDIN_CODE` (400), `LINKEDIN_AUTH_NOT_CONFIGURED` (400),
68
+ * `INVALID_LINKEDIN_TOKEN` (400), `LINKEDIN_AUTH_FAILED` (500)
69
+ * - `ACCOUNT_EXISTS_UNVERIFIED` (409) — same shared verified-to-verified linking policy as
70
+ * {@link googleLogin}/{@link appleLogin}.
71
+ *
72
+ * Gated by step-up MFA — see {@link login} for the `MFA_REQUIRED` error shape.
73
+ */
74
+ function linkedInLogin(clientId: string, code: string, redirectUri: string, trustedDeviceToken?: string): Promise<AuthLoginResponse>;
57
75
  /**
58
76
  * Sign in with Apple via an Apple identity token (public).
59
77
  *
@@ -83,6 +83,32 @@ export var authKit;
83
83
  return res;
84
84
  }
85
85
  authKit.googleCodeLogin = googleCodeLogin;
86
+ /**
87
+ * Sign in with LinkedIn (OpenID Connect) via a server-side authorization code (public).
88
+ *
89
+ * LinkedIn has no client-side ID-token SDK, so this is always the authorization-code flow:
90
+ * redirect the browser to LinkedIn's authorize endpoint, then pass the returned one-time
91
+ * `code` (and the exact `redirectUri` used) here — the server exchanges it (with the app's
92
+ * client secret) and verifies the id_token. Mirrors {@link googleCodeLogin}: on success the
93
+ * bearer token is stored and the cache invalidated.
94
+ *
95
+ * Notable error codes (thrown as `SmartlinksApiError`, read via `err.errorCode`):
96
+ * - `MISSING_LINKEDIN_CODE` (400), `LINKEDIN_AUTH_NOT_CONFIGURED` (400),
97
+ * `INVALID_LINKEDIN_TOKEN` (400), `LINKEDIN_AUTH_FAILED` (500)
98
+ * - `ACCOUNT_EXISTS_UNVERIFIED` (409) — same shared verified-to-verified linking policy as
99
+ * {@link googleLogin}/{@link appleLogin}.
100
+ *
101
+ * Gated by step-up MFA — see {@link login} for the `MFA_REQUIRED` error shape.
102
+ */
103
+ async function linkedInLogin(clientId, code, redirectUri, trustedDeviceToken) {
104
+ const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/linkedin`, { code, redirectUri, trustedDeviceToken });
105
+ if (res.token) {
106
+ setBearerToken(res.token);
107
+ invalidateCache();
108
+ }
109
+ return res;
110
+ }
111
+ authKit.linkedInLogin = linkedInLogin;
86
112
  /**
87
113
  * Sign in with Apple via an Apple identity token (public).
88
114
  *
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.0.0-alpha.6 | Generated: 2026-09-14T20:20:02.351Z
3
+ Version: 2.0.1 | Generated: 2026-09-16T05:23:18.331Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -9353,6 +9353,9 @@ Google OAuth login via ID token (public). Gated by step-up MFA — see {@link lo
9353
9353
  **googleCodeLogin**(clientId: string, code: string, redirectUri: string) → `Promise<AuthLoginResponse>`
9354
9354
  Google OAuth login via server-side authorization code (public).
9355
9355
 
9356
+ **linkedInLogin**(clientId: string, code: string, redirectUri: string, trustedDeviceToken?: string) → `Promise<AuthLoginResponse>`
9357
+ Sign in with LinkedIn (OpenID Connect) via a server-side authorization code (public). LinkedIn has no client-side ID-token SDK, so this is always the authorization-code flow: redirect the browser to LinkedIn's authorize endpoint, then pass the returned one-time `code` (and the exact `redirectUri` used) here — the server exchanges it (with the app's client secret) and verifies the id_token. Mirrors {@link googleCodeLogin}: on success the bearer token is stored and the cache invalidated. Notable error codes (thrown as `SmartlinksApiError`, read via `err.errorCode`): - `MISSING_LINKEDIN_CODE` (400), `LINKEDIN_AUTH_NOT_CONFIGURED` (400), `INVALID_LINKEDIN_TOKEN` (400), `LINKEDIN_AUTH_FAILED` (500) - `ACCOUNT_EXISTS_UNVERIFIED` (409) — same shared verified-to-verified linking policy as {@link googleLogin}/{@link appleLogin}. Gated by step-up MFA — see {@link login} for the `MFA_REQUIRED` error shape.
9358
+
9356
9359
  **appleLogin**(clientId: string, identityToken: string, opts?: AppleLoginOptions) → `Promise<AuthLoginResponse>`
9357
9360
  Sign in with Apple via an Apple identity token (public). Mirrors {@link googleLogin}. On success the returned bearer token is stored automatically and the cache is invalidated. Notable error codes (thrown as `SmartlinksApiError`, read via `err.errorCode`): - `MISSING_APPLE_TOKEN` (400), `APPLE_AUTH_NOT_CONFIGURED` (400), `INVALID_APPLE_TOKEN` (401), `APPLE_AUTH_FAILED` (500) - `ACCOUNT_EXISTS_UNVERIFIED` (409) — an unverified account already owns this email; the server refuses to silently link. `err.details.requiresEmailVerification` is `true`. Recoverable: the user should sign in with their password (or reset it), then link Apple from settings. **The same 409 can now come back from {@link googleLogin}** under the shared verified-to-verified linking policy. Gated by step-up MFA — see {@link login} for the `MFA_REQUIRED` error shape. Pass `opts.trustedDeviceToken` to skip the challenge on a recognized device.
9358
9361
 
package/dist/openapi.yaml CHANGED
@@ -8842,6 +8842,32 @@ paths:
8842
8842
  description: Unauthorized
8843
8843
  404:
8844
8844
  description: Not found
8845
+ /authkit/{clientId}/auth/linkedin:
8846
+ post:
8847
+ tags:
8848
+ - authKit
8849
+ summary: authKit.linkedInLogin
8850
+ operationId: authKit_linkedInLogin
8851
+ security: []
8852
+ parameters:
8853
+ - name: clientId
8854
+ in: path
8855
+ required: true
8856
+ schema:
8857
+ type: string
8858
+ responses:
8859
+ 200:
8860
+ description: Success
8861
+ content:
8862
+ application/json:
8863
+ schema:
8864
+ $ref: "#/components/schemas/AuthLoginResponse"
8865
+ 400:
8866
+ description: Bad request
8867
+ 401:
8868
+ description: Unauthorized
8869
+ 404:
8870
+ description: Not found
8845
8871
  /authkit/{clientId}/auth/login:
8846
8872
  post:
8847
8873
  tags:
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.0.0-alpha.6 | Generated: 2026-09-14T20:20:02.351Z
3
+ Version: 2.0.1 | Generated: 2026-09-16T05:23:18.331Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -9353,6 +9353,9 @@ Google OAuth login via ID token (public). Gated by step-up MFA — see {@link lo
9353
9353
  **googleCodeLogin**(clientId: string, code: string, redirectUri: string) → `Promise<AuthLoginResponse>`
9354
9354
  Google OAuth login via server-side authorization code (public).
9355
9355
 
9356
+ **linkedInLogin**(clientId: string, code: string, redirectUri: string, trustedDeviceToken?: string) → `Promise<AuthLoginResponse>`
9357
+ Sign in with LinkedIn (OpenID Connect) via a server-side authorization code (public). LinkedIn has no client-side ID-token SDK, so this is always the authorization-code flow: redirect the browser to LinkedIn's authorize endpoint, then pass the returned one-time `code` (and the exact `redirectUri` used) here — the server exchanges it (with the app's client secret) and verifies the id_token. Mirrors {@link googleCodeLogin}: on success the bearer token is stored and the cache invalidated. Notable error codes (thrown as `SmartlinksApiError`, read via `err.errorCode`): - `MISSING_LINKEDIN_CODE` (400), `LINKEDIN_AUTH_NOT_CONFIGURED` (400), `INVALID_LINKEDIN_TOKEN` (400), `LINKEDIN_AUTH_FAILED` (500) - `ACCOUNT_EXISTS_UNVERIFIED` (409) — same shared verified-to-verified linking policy as {@link googleLogin}/{@link appleLogin}. Gated by step-up MFA — see {@link login} for the `MFA_REQUIRED` error shape.
9358
+
9356
9359
  **appleLogin**(clientId: string, identityToken: string, opts?: AppleLoginOptions) → `Promise<AuthLoginResponse>`
9357
9360
  Sign in with Apple via an Apple identity token (public). Mirrors {@link googleLogin}. On success the returned bearer token is stored automatically and the cache is invalidated. Notable error codes (thrown as `SmartlinksApiError`, read via `err.errorCode`): - `MISSING_APPLE_TOKEN` (400), `APPLE_AUTH_NOT_CONFIGURED` (400), `INVALID_APPLE_TOKEN` (401), `APPLE_AUTH_FAILED` (500) - `ACCOUNT_EXISTS_UNVERIFIED` (409) — an unverified account already owns this email; the server refuses to silently link. `err.details.requiresEmailVerification` is `true`. Recoverable: the user should sign in with their password (or reset it), then link Apple from settings. **The same 409 can now come back from {@link googleLogin}** under the shared verified-to-verified linking policy. Gated by step-up MFA — see {@link login} for the `MFA_REQUIRED` error shape. Pass `opts.trustedDeviceToken` to skip the challenge on a recognized device.
9358
9361
 
package/openapi.yaml CHANGED
@@ -8842,6 +8842,32 @@ paths:
8842
8842
  description: Unauthorized
8843
8843
  404:
8844
8844
  description: Not found
8845
+ /authkit/{clientId}/auth/linkedin:
8846
+ post:
8847
+ tags:
8848
+ - authKit
8849
+ summary: authKit.linkedInLogin
8850
+ operationId: authKit_linkedInLogin
8851
+ security: []
8852
+ parameters:
8853
+ - name: clientId
8854
+ in: path
8855
+ required: true
8856
+ schema:
8857
+ type: string
8858
+ responses:
8859
+ 200:
8860
+ description: Success
8861
+ content:
8862
+ application/json:
8863
+ schema:
8864
+ $ref: "#/components/schemas/AuthLoginResponse"
8865
+ 400:
8866
+ description: Bad request
8867
+ 401:
8868
+ description: Unauthorized
8869
+ 404:
8870
+ description: Not found
8845
8871
  /authkit/{clientId}/auth/login:
8846
8872
  post:
8847
8873
  tags:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.1",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",