@vercel/oidc 3.4.0 → 3.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/oidc
2
2
 
3
+ ## 3.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ae20217: Upgrade to TypeScript 5.9
8
+
3
9
  ## 3.4.0
4
10
 
5
11
  ### Minor Changes
package/docs/README.md CHANGED
@@ -1,149 +1,17 @@
1
- # @vercel/oidc
1
+ **@vercel/oidc**
2
+
3
+ ---
2
4
 
3
- ## Table of contents
5
+ # @vercel/oidc
4
6
 
5
- ### Classes
7
+ ## Classes
6
8
 
7
9
  - [AccessTokenMissingError](classes/AccessTokenMissingError.md)
8
10
  - [RefreshAccessTokenFailedError](classes/RefreshAccessTokenFailedError.md)
9
11
 
10
- ### Functions
11
-
12
- - [getContext](README.md#getcontext)
13
- - [getVercelOidcToken](README.md#getverceloidctoken)
14
- - [getVercelOidcTokenSync](README.md#getverceloidctokensync)
15
- - [getVercelToken](README.md#getverceltoken)
16
-
17
12
  ## Functions
18
13
 
19
- ### getContext
20
-
21
- ▸ **getContext**(): `Context`
22
-
23
- #### Returns
24
-
25
- `Context`
26
-
27
- #### Defined in
28
-
29
- [packages/oidc/src/get-context.ts:7](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-context.ts#L7)
30
-
31
- ---
32
-
33
- ### getVercelOidcToken
34
-
35
- ▸ **getVercelOidcToken**(`options?`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
36
-
37
- Gets the current OIDC token from the request context or the environment variable.
38
-
39
- Do not cache this value, as it is subject to change in production!
40
-
41
- This function is used to retrieve the OIDC token from the request context or the environment variable.
42
- It checks for the `x-vercel-oidc-token` header in the request context and falls back to the `VERCEL_OIDC_TOKEN` environment variable if the header is not present.
43
-
44
- Unlike the `getVercelOidcTokenSync` function, this function will refresh the token if it is expired in a development environment.
45
-
46
- **`Throws`**
47
-
48
- If the `x-vercel-oidc-token` header is missing from the request context and the environment variable `VERCEL_OIDC_TOKEN` is not set. If the token
49
- is expired in a development environment, will also throw an error if the token cannot be refreshed: no CLI credentials are available, CLI credentials are expired, no project configuration is available
50
- or the token refresh request fails.
51
-
52
- **`Example`**
53
-
54
- ```js
55
- // Using the OIDC token
56
- getVercelOidcToken()
57
- .then(token => {
58
- console.log('OIDC Token:', token);
59
- })
60
- .catch(error => {
61
- console.error('Error:', error.message);
62
- });
63
- ```
64
-
65
- **`Example`**
66
-
67
- ```js
68
- // Using the OIDC token with explicit team and project (supports IDs and slugs)
69
- getVercelOidcToken({ team: 'my-team', project: 'my-project' })
70
- .then(token => {
71
- console.log('OIDC Token:', token);
72
- })
73
- .catch(error => {
74
- console.error('Error:', error.message);
75
- });
76
- ```
77
-
78
- #### Parameters
79
-
80
- | Name | Type | Description |
81
- | :--------- | :-------------------------- | :------------------------------------------ |
82
- | `options?` | `GetVercelOidcTokenOptions` | Optional configuration for token retrieval. |
83
-
84
- #### Returns
85
-
86
- [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
87
-
88
- A promise that resolves to the OIDC token.
89
-
90
- #### Defined in
91
-
92
- [packages/oidc/src/get-vercel-oidc-token.ts:64](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token.ts#L64)
93
-
94
- ---
95
-
96
- ### getVercelOidcTokenSync
97
-
98
- ▸ **getVercelOidcTokenSync**(): `string`
99
-
100
- Gets the current OIDC token from the request context or the environment variable.
101
-
102
- Do not cache this value, as it is subject to change in production!
103
-
104
- This function is used to retrieve the OIDC token from the request context or the environment variable.
105
- It checks for the `x-vercel-oidc-token` header in the request context and falls back to the `VERCEL_OIDC_TOKEN` environment variable if the header is not present.
106
-
107
- This function will not refresh the token if it is expired. For refreshing the token, use the @{link getVercelOidcToken} function.
108
-
109
- **`Throws`**
110
-
111
- If the `x-vercel-oidc-token` header is missing from the request context and the environment variable `VERCEL_OIDC_TOKEN` is not set.
112
-
113
- **`Example`**
114
-
115
- ```js
116
- // Using the OIDC token
117
- const token = getVercelOidcTokenSync();
118
- console.log('OIDC Token:', token);
119
- ```
120
-
121
- #### Returns
122
-
123
- `string`
124
-
125
- The OIDC token.
126
-
127
- #### Defined in
128
-
129
- [packages/oidc/src/get-vercel-oidc-token.ts:124](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token.ts#L124)
130
-
131
- ---
132
-
133
- ### getVercelToken
134
-
135
- ▸ **getVercelToken**(`options?`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
136
-
137
- #### Parameters
138
-
139
- | Name | Type |
140
- | :--------- | :---------------------- |
141
- | `options?` | `GetVercelTokenOptions` |
142
-
143
- #### Returns
144
-
145
- [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
146
-
147
- #### Defined in
148
-
149
- [packages/oidc/src/token-util.ts:35](https://github.com/vercel/vercel/blob/main/packages/oidc/src/token-util.ts#L35)
14
+ - [getContext](functions/getContext.md)
15
+ - [getVercelOidcToken](functions/getVercelOidcToken.md)
16
+ - [getVercelOidcTokenSync](functions/getVercelOidcTokenSync.md)
17
+ - [getVercelToken](functions/getVercelToken.md)
@@ -1,151 +1,133 @@
1
- # Class: AccessTokenMissingError
2
-
3
- Error thrown when no authentication configuration is found.
4
- This typically means the user needs to log in.
5
-
6
- ## Hierarchy
1
+ [**@vercel/oidc**](../README.md)
7
2
 
8
- - [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
3
+ ---
9
4
 
10
- ↳ **`AccessTokenMissingError`**
5
+ # Class: AccessTokenMissingError
11
6
 
12
- ## Table of contents
7
+ Defined in: [packages/oidc/src/auth-errors.ts:5](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L5)
13
8
 
14
- ### Constructors
9
+ Error thrown when no authentication configuration is found.
10
+ This typically means the user needs to log in.
15
11
 
16
- - [constructor](AccessTokenMissingError.md#constructor)
12
+ ## Extends
17
13
 
18
- ### Properties
14
+ - [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)
19
15
 
20
- - [message](AccessTokenMissingError.md#message)
21
- - [name](AccessTokenMissingError.md#name)
22
- - [stack](AccessTokenMissingError.md#stack)
23
- - [prepareStackTrace](AccessTokenMissingError.md#preparestacktrace)
24
- - [stackTraceLimit](AccessTokenMissingError.md#stacktracelimit)
16
+ ## Constructors
25
17
 
26
- ### Methods
18
+ ### Constructor
27
19
 
28
- - [captureStackTrace](AccessTokenMissingError.md#capturestacktrace)
20
+ > **new AccessTokenMissingError**(): `AccessTokenMissingError`
29
21
 
30
- ## Constructors
22
+ Defined in: [packages/oidc/src/auth-errors.ts:7](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L7)
31
23
 
32
- ### constructor
24
+ #### Returns
33
25
 
34
- • **new AccessTokenMissingError**()
26
+ `AccessTokenMissingError`
35
27
 
36
28
  #### Overrides
37
29
 
38
- Error.constructor
39
-
40
- #### Defined in
41
-
42
- [packages/oidc/src/auth-errors.ts:7](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L7)
30
+ `Error.constructor`
43
31
 
44
32
  ## Properties
45
33
 
46
34
  ### message
47
35
 
48
- • **message**: `string`
49
-
50
- #### Inherited from
36
+ > **message**: `string`
51
37
 
52
- Error.message
38
+ Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
53
39
 
54
- #### Defined in
40
+ #### Inherited from
55
41
 
56
- node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib/lib.es5.d.ts:1054
42
+ `Error.message`
57
43
 
58
44
  ---
59
45
 
60
46
  ### name
61
47
 
62
- • **name**: `string` = `'AccessTokenMissingError'`
48
+ > **name**: `string` = `'AccessTokenMissingError'`
63
49
 
64
- #### Overrides
50
+ Defined in: [packages/oidc/src/auth-errors.ts:6](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L6)
65
51
 
66
- Error.name
67
-
68
- #### Defined in
52
+ #### Overrides
69
53
 
70
- [packages/oidc/src/auth-errors.ts:6](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L6)
54
+ `Error.name`
71
55
 
72
56
  ---
73
57
 
74
- ### stack
58
+ ### stack?
75
59
 
76
- • `Optional` **stack**: `string`
60
+ > `optional` **stack?**: `string`
77
61
 
78
- #### Inherited from
79
-
80
- Error.stack
62
+ Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
81
63
 
82
- #### Defined in
64
+ #### Inherited from
83
65
 
84
- node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib/lib.es5.d.ts:1055
66
+ `Error.stack`
85
67
 
86
68
  ---
87
69
 
88
- ### prepareStackTrace
70
+ ### prepareStackTrace?
89
71
 
90
- ▪ `Static` `Optional` **prepareStackTrace**: (`err`: [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), `stackTraces`: `CallSite`[]) => `any`
72
+ > `static` `optional` **prepareStackTrace?**: (`err`, `stackTraces`) => `any`
91
73
 
92
- #### Type declaration
93
-
94
- ▸ (`err`, `stackTraces`): `any`
74
+ Defined in: node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:28
95
75
 
96
76
  Optional override for formatting stack traces
97
77
 
98
- **`See`**
78
+ #### Parameters
79
+
80
+ ##### err
99
81
 
100
- https://v8.dev/docs/stack-trace-api#customizing-stack-traces
82
+ [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)
101
83
 
102
- ##### Parameters
84
+ ##### stackTraces
103
85
 
104
- | Name | Type |
105
- | :------------ | :------------------------------------------------------------------------------------------------ |
106
- | `err` | [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) |
107
- | `stackTraces` | `CallSite`[] |
86
+ `CallSite`[]
108
87
 
109
- ##### Returns
88
+ #### Returns
110
89
 
111
90
  `any`
112
91
 
113
- #### Inherited from
92
+ #### See
114
93
 
115
- Error.prepareStackTrace
94
+ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
116
95
 
117
- #### Defined in
96
+ #### Inherited from
118
97
 
119
- node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:28
98
+ `Error.prepareStackTrace`
120
99
 
121
100
  ---
122
101
 
123
102
  ### stackTraceLimit
124
103
 
125
- ▪ `Static` **stackTraceLimit**: `number`
126
-
127
- #### Inherited from
104
+ > `static` **stackTraceLimit**: `number`
128
105
 
129
- Error.stackTraceLimit
106
+ Defined in: node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:30
130
107
 
131
- #### Defined in
108
+ #### Inherited from
132
109
 
133
- node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:30
110
+ `Error.stackTraceLimit`
134
111
 
135
112
  ## Methods
136
113
 
137
- ### captureStackTrace
114
+ ### captureStackTrace()
115
+
116
+ > `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
138
117
 
139
- ▸ `Static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
118
+ Defined in: node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:21
140
119
 
141
120
  Create .stack property on a target object
142
121
 
143
122
  #### Parameters
144
123
 
145
- | Name | Type |
146
- | :---------------- | :------------------------------------------------------------------------------------------------------ |
147
- | `targetObject` | `object` |
148
- | `constructorOpt?` | [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
124
+ ##### targetObject
125
+
126
+ `object`
127
+
128
+ ##### constructorOpt?
129
+
130
+ [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function)
149
131
 
150
132
  #### Returns
151
133
 
@@ -153,8 +135,4 @@ Create .stack property on a target object
153
135
 
154
136
  #### Inherited from
155
137
 
156
- Error.captureStackTrace
157
-
158
- #### Defined in
159
-
160
- node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:21
138
+ `Error.captureStackTrace`
@@ -1,157 +1,139 @@
1
- # Class: RefreshAccessTokenFailedError
2
-
3
- Error thrown when attempting to refresh the authentication token fails.
4
- This includes cases where no refresh token is available.
1
+ [**@vercel/oidc**](../README.md)
5
2
 
6
- ## Hierarchy
3
+ ---
7
4
 
8
- - [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
5
+ # Class: RefreshAccessTokenFailedError
9
6
 
10
- ↳ **`RefreshAccessTokenFailedError`**
7
+ Defined in: [packages/oidc/src/auth-errors.ts:18](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L18)
11
8
 
12
- ## Table of contents
9
+ Error thrown when attempting to refresh the authentication token fails.
10
+ This includes cases where no refresh token is available.
13
11
 
14
- ### Constructors
12
+ ## Extends
15
13
 
16
- - [constructor](RefreshAccessTokenFailedError.md#constructor)
14
+ - [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)
17
15
 
18
- ### Properties
16
+ ## Constructors
19
17
 
20
- - [message](RefreshAccessTokenFailedError.md#message)
21
- - [name](RefreshAccessTokenFailedError.md#name)
22
- - [stack](RefreshAccessTokenFailedError.md#stack)
23
- - [prepareStackTrace](RefreshAccessTokenFailedError.md#preparestacktrace)
24
- - [stackTraceLimit](RefreshAccessTokenFailedError.md#stacktracelimit)
18
+ ### Constructor
25
19
 
26
- ### Methods
20
+ > **new RefreshAccessTokenFailedError**(`cause?`): `RefreshAccessTokenFailedError`
27
21
 
28
- - [captureStackTrace](RefreshAccessTokenFailedError.md#capturestacktrace)
22
+ Defined in: [packages/oidc/src/auth-errors.ts:20](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L20)
29
23
 
30
- ## Constructors
24
+ #### Parameters
31
25
 
32
- ### constructor
26
+ ##### cause?
33
27
 
34
- • **new RefreshAccessTokenFailedError**(`cause?`)
28
+ `unknown`
35
29
 
36
- #### Parameters
30
+ #### Returns
37
31
 
38
- | Name | Type |
39
- | :------- | :-------- |
40
- | `cause?` | `unknown` |
32
+ `RefreshAccessTokenFailedError`
41
33
 
42
34
  #### Overrides
43
35
 
44
- Error.constructor
45
-
46
- #### Defined in
47
-
48
- [packages/oidc/src/auth-errors.ts:20](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L20)
36
+ `Error.constructor`
49
37
 
50
38
  ## Properties
51
39
 
52
40
  ### message
53
41
 
54
- • **message**: `string`
55
-
56
- #### Inherited from
42
+ > **message**: `string`
57
43
 
58
- Error.message
44
+ Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
59
45
 
60
- #### Defined in
46
+ #### Inherited from
61
47
 
62
- node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib/lib.es5.d.ts:1054
48
+ `Error.message`
63
49
 
64
50
  ---
65
51
 
66
52
  ### name
67
53
 
68
- • **name**: `string` = `'RefreshAccessTokenFailedError'`
54
+ > **name**: `string` = `'RefreshAccessTokenFailedError'`
69
55
 
70
- #### Overrides
56
+ Defined in: [packages/oidc/src/auth-errors.ts:19](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L19)
71
57
 
72
- Error.name
73
-
74
- #### Defined in
58
+ #### Overrides
75
59
 
76
- [packages/oidc/src/auth-errors.ts:19](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L19)
60
+ `Error.name`
77
61
 
78
62
  ---
79
63
 
80
- ### stack
64
+ ### stack?
81
65
 
82
- • `Optional` **stack**: `string`
66
+ > `optional` **stack?**: `string`
83
67
 
84
- #### Inherited from
85
-
86
- Error.stack
68
+ Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
87
69
 
88
- #### Defined in
70
+ #### Inherited from
89
71
 
90
- node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib/lib.es5.d.ts:1055
72
+ `Error.stack`
91
73
 
92
74
  ---
93
75
 
94
- ### prepareStackTrace
76
+ ### prepareStackTrace?
95
77
 
96
- ▪ `Static` `Optional` **prepareStackTrace**: (`err`: [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), `stackTraces`: `CallSite`[]) => `any`
78
+ > `static` `optional` **prepareStackTrace?**: (`err`, `stackTraces`) => `any`
97
79
 
98
- #### Type declaration
99
-
100
- ▸ (`err`, `stackTraces`): `any`
80
+ Defined in: node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:28
101
81
 
102
82
  Optional override for formatting stack traces
103
83
 
104
- **`See`**
84
+ #### Parameters
85
+
86
+ ##### err
105
87
 
106
- https://v8.dev/docs/stack-trace-api#customizing-stack-traces
88
+ [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)
107
89
 
108
- ##### Parameters
90
+ ##### stackTraces
109
91
 
110
- | Name | Type |
111
- | :------------ | :------------------------------------------------------------------------------------------------ |
112
- | `err` | [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) |
113
- | `stackTraces` | `CallSite`[] |
92
+ `CallSite`[]
114
93
 
115
- ##### Returns
94
+ #### Returns
116
95
 
117
96
  `any`
118
97
 
119
- #### Inherited from
98
+ #### See
120
99
 
121
- Error.prepareStackTrace
100
+ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
122
101
 
123
- #### Defined in
102
+ #### Inherited from
124
103
 
125
- node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:28
104
+ `Error.prepareStackTrace`
126
105
 
127
106
  ---
128
107
 
129
108
  ### stackTraceLimit
130
109
 
131
- ▪ `Static` **stackTraceLimit**: `number`
132
-
133
- #### Inherited from
110
+ > `static` **stackTraceLimit**: `number`
134
111
 
135
- Error.stackTraceLimit
112
+ Defined in: node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:30
136
113
 
137
- #### Defined in
114
+ #### Inherited from
138
115
 
139
- node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:30
116
+ `Error.stackTraceLimit`
140
117
 
141
118
  ## Methods
142
119
 
143
- ### captureStackTrace
120
+ ### captureStackTrace()
121
+
122
+ > `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
144
123
 
145
- ▸ `Static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
124
+ Defined in: node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:21
146
125
 
147
126
  Create .stack property on a target object
148
127
 
149
128
  #### Parameters
150
129
 
151
- | Name | Type |
152
- | :---------------- | :------------------------------------------------------------------------------------------------------ |
153
- | `targetObject` | `object` |
154
- | `constructorOpt?` | [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
130
+ ##### targetObject
131
+
132
+ `object`
133
+
134
+ ##### constructorOpt?
135
+
136
+ [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function)
155
137
 
156
138
  #### Returns
157
139
 
@@ -159,8 +141,4 @@ Create .stack property on a target object
159
141
 
160
142
  #### Inherited from
161
143
 
162
- Error.captureStackTrace
163
-
164
- #### Defined in
165
-
166
- node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:21
144
+ `Error.captureStackTrace`
@@ -0,0 +1,13 @@
1
+ [**@vercel/oidc**](../README.md)
2
+
3
+ ---
4
+
5
+ # Function: getContext()
6
+
7
+ > **getContext**(): `Context`
8
+
9
+ Defined in: [packages/oidc/src/get-context.ts:7](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-context.ts#L7)
10
+
11
+ ## Returns
12
+
13
+ `Context`
@@ -0,0 +1,62 @@
1
+ [**@vercel/oidc**](../README.md)
2
+
3
+ ---
4
+
5
+ # Function: getVercelOidcToken()
6
+
7
+ > **getVercelOidcToken**(`options?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\>
8
+
9
+ Defined in: [packages/oidc/src/get-vercel-oidc-token.ts:64](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token.ts#L64)
10
+
11
+ Gets the current OIDC token from the request context or the environment variable.
12
+
13
+ Do not cache this value, as it is subject to change in production!
14
+
15
+ This function is used to retrieve the OIDC token from the request context or the environment variable.
16
+ It checks for the `x-vercel-oidc-token` header in the request context and falls back to the `VERCEL_OIDC_TOKEN` environment variable if the header is not present.
17
+
18
+ Unlike the `getVercelOidcTokenSync` function, this function will refresh the token if it is expired in a development environment.
19
+
20
+ ## Parameters
21
+
22
+ ### options?
23
+
24
+ `GetVercelOidcTokenOptions`
25
+
26
+ Optional configuration for token retrieval.
27
+
28
+ ## Returns
29
+
30
+ [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\>
31
+
32
+ A promise that resolves to the OIDC token.
33
+
34
+ ## Throws
35
+
36
+ If the `x-vercel-oidc-token` header is missing from the request context and the environment variable `VERCEL_OIDC_TOKEN` is not set. If the token
37
+ is expired in a development environment, will also throw an error if the token cannot be refreshed: no CLI credentials are available, CLI credentials are expired, no project configuration is available
38
+ or the token refresh request fails.
39
+
40
+ ## Examples
41
+
42
+ ```js
43
+ // Using the OIDC token
44
+ getVercelOidcToken()
45
+ .then(token => {
46
+ console.log('OIDC Token:', token);
47
+ })
48
+ .catch(error => {
49
+ console.error('Error:', error.message);
50
+ });
51
+ ```
52
+
53
+ ```js
54
+ // Using the OIDC token with explicit team and project (supports IDs and slugs)
55
+ getVercelOidcToken({ team: 'my-team', project: 'my-project' })
56
+ .then(token => {
57
+ console.log('OIDC Token:', token);
58
+ })
59
+ .catch(error => {
60
+ console.error('Error:', error.message);
61
+ });
62
+ ```
@@ -0,0 +1,36 @@
1
+ [**@vercel/oidc**](../README.md)
2
+
3
+ ---
4
+
5
+ # Function: getVercelOidcTokenSync()
6
+
7
+ > **getVercelOidcTokenSync**(): `string`
8
+
9
+ Defined in: [packages/oidc/src/get-vercel-oidc-token.ts:124](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token.ts#L124)
10
+
11
+ Gets the current OIDC token from the request context or the environment variable.
12
+
13
+ Do not cache this value, as it is subject to change in production!
14
+
15
+ This function is used to retrieve the OIDC token from the request context or the environment variable.
16
+ It checks for the `x-vercel-oidc-token` header in the request context and falls back to the `VERCEL_OIDC_TOKEN` environment variable if the header is not present.
17
+
18
+ This function will not refresh the token if it is expired. For refreshing the token, use the @{link getVercelOidcToken} function.
19
+
20
+ ## Returns
21
+
22
+ `string`
23
+
24
+ The OIDC token.
25
+
26
+ ## Throws
27
+
28
+ If the `x-vercel-oidc-token` header is missing from the request context and the environment variable `VERCEL_OIDC_TOKEN` is not set.
29
+
30
+ ## Example
31
+
32
+ ```js
33
+ // Using the OIDC token
34
+ const token = getVercelOidcTokenSync();
35
+ console.log('OIDC Token:', token);
36
+ ```
@@ -0,0 +1,19 @@
1
+ [**@vercel/oidc**](../README.md)
2
+
3
+ ---
4
+
5
+ # Function: getVercelToken()
6
+
7
+ > **getVercelToken**(`options?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\>
8
+
9
+ Defined in: [packages/oidc/src/token-util.ts:35](https://github.com/vercel/vercel/blob/main/packages/oidc/src/token-util.ts#L35)
10
+
11
+ ## Parameters
12
+
13
+ ### options?
14
+
15
+ `GetVercelTokenOptions`
16
+
17
+ ## Returns
18
+
19
+ [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\>
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "require": "./dist/index.js"
18
18
  }
19
19
  },
20
- "version": "3.4.0",
20
+ "version": "3.4.1",
21
21
  "repository": {
22
22
  "directory": "packages/oidc",
23
23
  "type": "git",
@@ -29,9 +29,9 @@
29
29
  "devDependencies": {
30
30
  "prettier": "3.8.3",
31
31
  "tinyspawn": "1.3.1",
32
- "typedoc": "0.24.6",
33
- "typedoc-plugin-markdown": "3.15.2",
34
- "typedoc-plugin-mdn-links": "3.0.3",
32
+ "typedoc": "0.28.19",
33
+ "typedoc-plugin-markdown": "4.11.0",
34
+ "typedoc-plugin-mdn-links": "5.1.1",
35
35
  "vitest": "2.0.1"
36
36
  },
37
37
  "peerDependenciesMeta": {},