@vercel/connect 0.2.3 → 0.2.4
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.
|
@@ -26,7 +26,7 @@ export interface AuthJsConnectOptions {
|
|
|
26
26
|
/**
|
|
27
27
|
* Scopes to request. `offline_access` is added automatically so
|
|
28
28
|
* the Vercel Connect side can mint refresh tokens. Defaults to
|
|
29
|
-
* `["openid"]`.
|
|
29
|
+
* `["openid", "profile", "email"]`.
|
|
30
30
|
*/
|
|
31
31
|
readonly scopes?: readonly string[];
|
|
32
32
|
/**
|
|
@@ -29,13 +29,14 @@ import { tryGetVercelTeamId, withTeamId } from '../internal/team-id.js';
|
|
|
29
29
|
const CONNECT_AUTHORIZATION_URL = 'https://connect.vercel.com/oauth/authorize';
|
|
30
30
|
const CONNECT_TOKEN_URL = 'https://connect.vercel.com/oauth/token';
|
|
31
31
|
const CONNECT_USERINFO_URL = 'https://connect.vercel.com/oauth/userinfo';
|
|
32
|
+
const DEFAULT_SCOPES = ['openid', 'profile', 'email'];
|
|
32
33
|
/**
|
|
33
34
|
* Builds an Auth.js `OAuth2Config` for Vercel Connect. Push the
|
|
34
35
|
* result into `AuthConfig.providers`.
|
|
35
36
|
*/
|
|
36
37
|
export function connect(options) {
|
|
37
38
|
const fetchVercelToken = options.getVercelOidcToken ?? getVercelOidcToken;
|
|
38
|
-
const scope = Array.from(new Set([...(options.scopes ??
|
|
39
|
+
const scope = Array.from(new Set([...(options.scopes ?? DEFAULT_SCOPES), 'offline_access'])).join(' ');
|
|
39
40
|
return {
|
|
40
41
|
id: options.id,
|
|
41
42
|
name: options.name,
|
|
@@ -15,7 +15,8 @@ export interface BetterAuthConnectOptions {
|
|
|
15
15
|
readonly connector: string;
|
|
16
16
|
/**
|
|
17
17
|
* Scopes to request. `offline_access` is added automatically so the
|
|
18
|
-
* Vercel Connect side can mint refresh tokens. Defaults to
|
|
18
|
+
* Vercel Connect side can mint refresh tokens. Defaults to
|
|
19
|
+
* `["openid", "profile", "email"]`.
|
|
19
20
|
*/
|
|
20
21
|
readonly scopes?: readonly string[];
|
|
21
22
|
/**
|
|
@@ -34,13 +34,14 @@ import { ConnectError, createConnectErrorFromResponse } from '../token.js';
|
|
|
34
34
|
const CONNECT_AUTHORIZATION_URL = 'https://connect.vercel.com/oauth/authorize';
|
|
35
35
|
const CONNECT_TOKEN_URL = 'https://connect.vercel.com/oauth/token';
|
|
36
36
|
const CONNECT_USERINFO_URL = 'https://connect.vercel.com/oauth/userinfo';
|
|
37
|
+
const DEFAULT_SCOPES = ['openid', 'profile', 'email'];
|
|
37
38
|
/**
|
|
38
39
|
* Builds a `GenericOAuthConfig` entry for Vercel Connect. Pass the
|
|
39
40
|
* result into `genericOAuth({ config: [...] })`.
|
|
40
41
|
*/
|
|
41
42
|
export function connect(options) {
|
|
42
43
|
const fetchVercelToken = options.getVercelOidcToken ?? getVercelOidcToken;
|
|
43
|
-
const scopes = Array.from(new Set([...(options.scopes ??
|
|
44
|
+
const scopes = Array.from(new Set([...(options.scopes ?? DEFAULT_SCOPES), 'offline_access']));
|
|
44
45
|
return {
|
|
45
46
|
providerId: options.providerId,
|
|
46
47
|
clientId: options.connector,
|