@mortar-ai/skill 0.7.2 → 0.7.3

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/manifest.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "id": "mortar",
4
- "version": "0.7.2",
5
- "content_sha256": "sha256:b0240a03057ebc2cf8b831e198e5769644d5ea8a7645b7e5a7a6d22965db2ef1",
4
+ "version": "0.7.3",
5
+ "content_sha256": "sha256:292ee5d8a7b9b5c8165142273a452815eb4418f0169937de0833f76bcf34d0e2",
6
6
  "source_repo": "liamxujia/appunvs",
7
7
  "source_path": "mortar/skill",
8
8
  "distributions": [
@@ -11,6 +11,6 @@
11
11
  ],
12
12
  "npm": {
13
13
  "package": "@mortar-ai/skill",
14
- "version": "0.7.2"
14
+ "version": "0.7.3"
15
15
  }
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mortar-ai/skill",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Agent skill for building Fabric applications on Appunvs Cloud powered by Mortar, with compact core guidance and on-demand references.",
5
5
  "main": "index.js",
6
6
  "files": ["SKILL.md", "references", "manifest.json", "index.js", "README.md"],
@@ -13,6 +13,13 @@ const signedIn = await mortar.auth.signInWithPassword({ email, password });
13
13
  const sent = await mortar.auth.signInWithOtp({ email }); // or { phone }
14
14
  const verified = await mortar.auth.verifyOtp({ email, token });
15
15
 
16
+ const providerLogin = await mortar.auth.signInWithProvider({
17
+ provider: 'google', // apple | google | wechat | alipay
18
+ connection: 'web',
19
+ idToken,
20
+ nonce,
21
+ });
22
+
16
23
  const { data: sessionData } = await mortar.auth.getSession();
17
24
  const { data: userData, error: userError } = await mortar.auth.getUser();
18
25
  await mortar.auth.signOut();
@@ -22,6 +29,11 @@ Check each returned `error`; do not infer authentication from the presence of UI
22
29
  state. Use `onAuthStateChange` when the UI must react to session changes and
23
30
  unsubscribe during component/page cleanup.
24
31
 
32
+ For provider login, obtain the authorization code or ID token with the
33
+ provider's browser/native SDK and validate OAuth `state` before calling Mortar.
34
+ Use `listOAuthProviders()` to discover the project's public connection IDs.
35
+ Never put provider client secrets or private keys in generated app code.
36
+
25
37
  Password reset starts with `mortar.auth.resetPasswordForEmail(email)` and is
26
38
  confirmed with `passwordResetConfirm(email, token, newPassword)`. Never store or
27
39
  pass session tokens manually unless the user explicitly needs a trusted server
@@ -577,6 +577,82 @@ paths:
577
577
  "401":
578
578
  description: invalid_credentials.
579
579
 
580
+ /v1/{tenant}/auth/providers:
581
+ parameters:
582
+ - $ref: "#/components/parameters/TenantPath"
583
+ get:
584
+ tags: [auth]
585
+ summary: List configured end-user OAuth provider connections.
586
+ description: |
587
+ Returns connection IDs plus public provider client/application IDs for
588
+ Apple, Google, WeChat, and Alipay. Provider secrets and private keys are
589
+ never returned. Connections are owned by the Mortar deployment and
590
+ shared across projects through `MORTAR_AUTH_APPLE`,
591
+ `MORTAR_AUTH_GOOGLE`, `MORTAR_AUTH_WECHAT`, and `MORTAR_AUTH_ALIPAY`.
592
+ Projects cannot supply or override provider credentials.
593
+ security:
594
+ - APIKey: []
595
+ responses:
596
+ "200":
597
+ description: Configured public provider metadata.
598
+ content:
599
+ application/json:
600
+ schema:
601
+ type: object
602
+ required: [providers]
603
+ properties:
604
+ providers:
605
+ type: array
606
+ items:
607
+ $ref: "#/components/schemas/OAuthProviderConfiguration"
608
+
609
+ /v1/{tenant}/auth/oauth/{provider}:
610
+ parameters:
611
+ - $ref: "#/components/parameters/TenantPath"
612
+ - name: provider
613
+ in: path
614
+ required: true
615
+ schema:
616
+ type: string
617
+ enum: [apple, google, wechat, alipay]
618
+ post:
619
+ tags: [auth]
620
+ summary: Exchange a provider credential for a Mortar User session.
621
+ description: |
622
+ The application starts the provider browser/native flow and validates
623
+ OAuth state before calling this endpoint. Google and Apple accept a
624
+ signed `id_token` or `authorization_code`; WeChat and Alipay accept an
625
+ `authorization_code`. A supplied OIDC nonce is checked against the ID
626
+ token. Successful login resolves a durable provider subject and returns
627
+ the same Mortar session shape as password and OTP login.
628
+ security:
629
+ - APIKey: []
630
+ requestBody:
631
+ required: true
632
+ content:
633
+ application/json:
634
+ schema:
635
+ $ref: "#/components/schemas/OAuthSignInRequest"
636
+ responses:
637
+ "200":
638
+ description: Provider identity verified and Mortar session issued.
639
+ content:
640
+ application/json:
641
+ schema:
642
+ $ref: "#/components/schemas/UserAuthResponse"
643
+ "400":
644
+ description: provider_credential_required / connection_required / connection_invalid.
645
+ "401":
646
+ description: invalid_provider_credential.
647
+ "404":
648
+ description: provider_unsupported.
649
+ "409":
650
+ description: identity_link_required.
651
+ "502":
652
+ description: provider_unavailable.
653
+ "503":
654
+ description: provider_not_configured.
655
+
580
656
  /v1/{tenant}/auth/phone/start:
581
657
  parameters:
582
658
  - $ref: "#/components/parameters/TenantPath"
@@ -2294,6 +2370,53 @@ components:
2294
2370
  type: string
2295
2371
  minLength: 8
2296
2372
 
2373
+ OAuthSignInRequest:
2374
+ type: object
2375
+ properties:
2376
+ connection:
2377
+ type: string
2378
+ description: |
2379
+ Named provider registration. Required when the provider has
2380
+ multiple connections and none is named `default`.
2381
+ authorization_code:
2382
+ type: string
2383
+ description: One-time code returned by the provider flow.
2384
+ id_token:
2385
+ type: string
2386
+ description: Signed Google or Apple OIDC ID token.
2387
+ redirect_uri:
2388
+ type: string
2389
+ format: uri
2390
+ description: Exact redirect URI used to obtain an authorization code.
2391
+ nonce:
2392
+ type: string
2393
+ description: Expected OIDC nonce; checked when supplied.
2394
+ code_verifier:
2395
+ type: string
2396
+ description: Google PKCE verifier used for authorization-code exchange.
2397
+
2398
+ OAuthProviderConfiguration:
2399
+ type: object
2400
+ required: [id, connections]
2401
+ properties:
2402
+ id:
2403
+ type: string
2404
+ enum: [apple, google, wechat, alipay]
2405
+ connections:
2406
+ type: array
2407
+ items:
2408
+ type: object
2409
+ required: [id, client_id]
2410
+ properties:
2411
+ id:
2412
+ type: string
2413
+ client_id:
2414
+ type: string
2415
+ description: Public OAuth client ID or provider AppID.
2416
+ mode:
2417
+ type: string
2418
+ description: Provider-specific mode, such as `mini_program`.
2419
+
2297
2420
  UserAuthResponse:
2298
2421
  type: object
2299
2422
  required: [access_token, user_id, expires_in_sec]