@jskit-ai/auth-provider-supabase-core 0.1.179 → 0.1.181

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/auth-provider-supabase-core",
3
- "version": "0.1.179",
3
+ "version": "0.1.181",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test"
@@ -59,7 +59,7 @@
59
59
  }
60
60
  },
61
61
  "peerDependencies": {
62
- "@jskit-ai/auth-core": "0.1.180",
63
- "@jskit-ai/kernel": "0.1.182"
62
+ "@jskit-ai/auth-core": "0.1.182",
63
+ "@jskit-ai/kernel": "0.1.184"
64
64
  }
65
65
  }
@@ -40,6 +40,31 @@ Use `@jskit-ai/auth-provider-supabase-core` for the provider and
40
40
  `@jskit-ai/auth-core` policy contracts. Configure `config.auth` through the
41
41
  application's ordinary server configuration.
42
42
 
43
+ ## Provider login policy and prerelease migration
44
+
45
+ Provider-specific login query parameters belong to the application. For example,
46
+ an application choosing Google's account picker can configure:
47
+
48
+ ```js
49
+ const config = {
50
+ auth: {
51
+ oauth: {
52
+ providers: ["google"],
53
+ defaultProvider: "google",
54
+ queryParams: { google: { prompt: "select_account" } }
55
+ }
56
+ }
57
+ };
58
+ ```
59
+
60
+ Pre-release applications that relied on the previous implicit Google
61
+ `select_account` parameter must add this configuration if they want to retain
62
+ that behavior. The runtime no longer supplies it automatically. This is a manual
63
+ V0 migration; there is no fallback to the old policy. These values control the
64
+ Supabase login flow. They do not configure a Gmail API connection or confer
65
+ mailbox permissions. The application still owns its identity and account-linking
66
+ policy, while connectors manage separately authorized provider access.
67
+
43
68
  ## Example files
44
69
 
45
70
  `example/package.json` declares the selected provider. `example/.env.example`
@@ -2,6 +2,6 @@
2
2
  "private": true,
3
3
  "type": "module",
4
4
  "dependencies": {
5
- "@jskit-ai/auth-provider-supabase-core": "0.1.179"
5
+ "@jskit-ai/auth-provider-supabase-core": "0.1.181"
6
6
  }
7
7
  }
@@ -12,7 +12,7 @@ const SUPABASE_OAUTH_PROVIDER_METADATA = Object.freeze({
12
12
  figma: Object.freeze({ id: "figma", label: "Figma" }),
13
13
  github: Object.freeze({ id: "github", label: "GitHub" }),
14
14
  gitlab: Object.freeze({ id: "gitlab", label: "GitLab" }),
15
- google: Object.freeze({ id: "google", label: "Google", queryParams: { prompt: "select_account" } }),
15
+ google: Object.freeze({ id: "google", label: "Google" }),
16
16
  kakao: Object.freeze({ id: "kakao", label: "Kakao" }),
17
17
  keycloak: Object.freeze({ id: "keycloak", label: "Keycloak" }),
18
18
  linkedin_oidc: Object.freeze({ id: "linkedin_oidc", label: "LinkedIn" }),
@@ -180,7 +180,7 @@ function createService(options) {
180
180
  passwordRecovery: {
181
181
  request: supabaseConfigured,
182
182
  complete: supabaseConfigured,
183
- delivery: supabaseConfigured ? "smtp" : "disabled"
183
+ delivery: supabaseConfigured ? "email" : "disabled"
184
184
  },
185
185
  otp: {
186
186
  login: supabaseConfigured
@@ -23,7 +23,8 @@ function oauthConfig(config) {
23
23
  providers: Array.isArray(oauth.providers)
24
24
  ? oauth.providers.map((entry) => String(entry || "").trim()).filter(Boolean)
25
25
  : splitCsv(oauth.providers),
26
- defaultProvider: String(oauth.defaultProvider || "").trim()
26
+ defaultProvider: String(oauth.defaultProvider || "").trim(),
27
+ queryParams: normalizeRecord(oauth.queryParams)
27
28
  };
28
29
  }
29
30
 
@@ -38,7 +39,8 @@ function providerConfig(env, config) {
38
39
  ).trim(),
39
40
  jwtAudience: String(env.AUTH_JWT_AUDIENCE || "authenticated").trim(),
40
41
  oauthProviders: envProviders.length > 0 ? envProviders : configuredOauth.providers,
41
- oauthDefaultProvider: String(env.AUTH_OAUTH_DEFAULT_PROVIDER || "").trim() || configuredOauth.defaultProvider
42
+ oauthDefaultProvider: String(env.AUTH_OAUTH_DEFAULT_PROVIDER || "").trim() || configuredOauth.defaultProvider,
43
+ oauthProviderQueryParams: configuredOauth.queryParams
42
44
  };
43
45
  }
44
46
 
@@ -24,7 +24,7 @@ function env(overrides = {}) {
24
24
  };
25
25
  }
26
26
 
27
- async function startRuntime({ profileMode = "provider", envOverrides = {}, identity = null, decorate = null } = {}) {
27
+ async function startRuntime({ profileMode = "provider", envOverrides = {}, identity = null, decorate = null, oauth = {} } = {}) {
28
28
  const extensions = createAuthExtensions();
29
29
  if (decorate) {
30
30
  extensions.registerServiceDecorator({
@@ -43,7 +43,7 @@ async function startRuntime({ profileMode = "provider", envOverrides = {}, ident
43
43
  });
44
44
  const inputs = {
45
45
  "auth.extensions": extensions,
46
- "runtime.config": config(profileMode),
46
+ "runtime.config": { ...config(profileMode), auth: { profileMode, oauth } },
47
47
  "runtime.env": env(envOverrides),
48
48
  ...(identity ? { "users.identity": identity } : {})
49
49
  };
@@ -109,3 +109,22 @@ test("AuthSupabaseProvider requires users.identity only when users profile proje
109
109
  /requires the users\.identity capability/
110
110
  );
111
111
  });
112
+
113
+
114
+ test("Supabase login query policy belongs to application configuration", async (t) => {
115
+ const originalFetch = globalThis.fetch;
116
+ globalThis.fetch = async () => { throw new Error("This fixture must not contact Supabase."); };
117
+ t.after(() => { globalThis.fetch = originalFetch; });
118
+ for (const queryParams of [{}, { google: { prompt: "select_account" } }]) {
119
+ const { authService, runtime } = await startRuntime({ oauth: { providers: ["google"], queryParams } });
120
+ try {
121
+ const result = await authService.oauthStart({ provider: "google", returnTo: "/" });
122
+ const url = new URL(result.url);
123
+ assert.equal(url.origin, "https://example.supabase.co");
124
+ assert.equal(url.searchParams.get("provider"), "google");
125
+ assert.equal(url.searchParams.get("prompt"), queryParams.google?.prompt || null);
126
+ } finally {
127
+ await runtime.shutdown();
128
+ }
129
+ }
130
+ });