@googleapis/sts 3.0.0 → 3.1.0
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 +7 -0
- package/build/v1.d.ts +136 -1
- package/build/v1.js +30 -0
- package/build/v1.js.map +1 -1
- package/package.json +2 -2
- package/v1.ts +214 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.1.0](https://github.com/googleapis/google-api-nodejs-client/compare/sts-v3.0.0...sts-v3.1.0) (2022-12-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **sts:** update the API ([6329c89](https://github.com/googleapis/google-api-nodejs-client/commit/6329c89747d9e6e8a31804cac232ba231e5ce56b))
|
|
9
|
+
|
|
3
10
|
## [3.0.0](https://github.com/googleapis/google-api-nodejs-client/compare/sts-v2.1.8...sts-v3.0.0) (2022-10-28)
|
|
4
11
|
|
|
5
12
|
|
package/build/v1.d.ts
CHANGED
|
@@ -157,6 +157,64 @@ export declare namespace sts_v1 {
|
|
|
157
157
|
*/
|
|
158
158
|
userProject?: string | null;
|
|
159
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Request message for ExchangeOauthToken
|
|
162
|
+
*/
|
|
163
|
+
export interface Schema$GoogleIdentityStsV1ExchangeOauthTokenRequest {
|
|
164
|
+
/**
|
|
165
|
+
* Optional. The client identifier for the OAuth 2.0 client that requested the provided token. It is REQUIRED when the [client] (https://www.rfc-editor.org/rfc/rfc6749#section-1.1) is not authenticating with the authorization server, i.e. when authentication method is [client authentication] (https://www.rfc-editor.org/rfc/rfc6749#section-3.2.1).
|
|
166
|
+
*/
|
|
167
|
+
clientId?: string | null;
|
|
168
|
+
/**
|
|
169
|
+
* Optional. The authorization code that was previously from workforce identity federation's `authorize` endpoint. Required if the flow is authorization code flow, i.e. if grant_type is 'authorization_code'
|
|
170
|
+
*/
|
|
171
|
+
code?: string | null;
|
|
172
|
+
/**
|
|
173
|
+
* Optional. The code verifier for the PKCE request, Google Cloud CLI originally generates it before the authorization request. PKCE is used to protect authorization code from interception attacks. See https://www.rfc-editor.org/rfc/rfc7636#section-1.1 and https://www.rfc-editor.org/rfc/rfc7636#section-3. It is required when the flow is authorization code flow, i.e. if grant_type is 'authorization_code'
|
|
174
|
+
*/
|
|
175
|
+
codeVerifier?: string | null;
|
|
176
|
+
/**
|
|
177
|
+
* Required. The grant types are as follows: - 'authorization_code' : an authorization code flow, i.e. exchange of authorization code for the Oauth access token - 'refresh_token' : a refresh token flow, i.e. obtain a new access token by providing the refresh token. See https://www.rfc-editor.org/rfc/rfc6749#section-6
|
|
178
|
+
*/
|
|
179
|
+
grantType?: string | null;
|
|
180
|
+
/**
|
|
181
|
+
* Optional. redirect_url is required when the flow is authorization code flow i.e. if grant_type is `authorization_code` See https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3
|
|
182
|
+
*/
|
|
183
|
+
redirectUri?: string | null;
|
|
184
|
+
/**
|
|
185
|
+
* Optional. The Refresh token is the credential that is used to obtain a new access token when the current access token becomes invalid or expires. Required when using refresh token flow, i.e. if `grant_type` is 'refresh_token' See https://www.rfc-editor.org/rfc/rfc6749#section-1.5 and https://www.rfc-editor.org/rfc/rfc6749#section-6
|
|
186
|
+
*/
|
|
187
|
+
refreshToken?: string | null;
|
|
188
|
+
/**
|
|
189
|
+
* Optional. An optional list of scopes that are requested for the token to be returned. See https://www.rfc-editor.org/rfc/rfc6749#section-3.3 Must be a list of space-delimited, case-sensitive strings. Note: Currently, the scopes in the request are not supported
|
|
190
|
+
*/
|
|
191
|
+
scope?: string | null;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Response message for ExchangeOauthToken. see https://www.rfc-editor.org/rfc/rfc6749#section-5.1
|
|
195
|
+
*/
|
|
196
|
+
export interface Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse {
|
|
197
|
+
/**
|
|
198
|
+
* An OAuth 2.0 security token, issued by Google, in response to the Oauth token exchange request for the authorization code and refresh token flows. The returned [access token](https://www.rfc-editor.org/rfc/rfc6749#section-4.1.4). Tokens can vary in size, depending, in part, on the size of mapped claims, up to a maximum of 12288 bytes (12 KB). Google reserves the right to change the token size and the maximum length at any time.
|
|
199
|
+
*/
|
|
200
|
+
access_token?: string | null;
|
|
201
|
+
/**
|
|
202
|
+
* The amount of time, in seconds, between the time when the access token was issued and the time when the access token will expires.
|
|
203
|
+
*/
|
|
204
|
+
expires_in?: number | null;
|
|
205
|
+
/**
|
|
206
|
+
* A refresh token, issued by Google, in response to the OAuth token exchange request for refresh token flow
|
|
207
|
+
*/
|
|
208
|
+
refresh_token?: string | null;
|
|
209
|
+
/**
|
|
210
|
+
* A list of scopes associated with the returned token.
|
|
211
|
+
*/
|
|
212
|
+
scope?: string | null;
|
|
213
|
+
/**
|
|
214
|
+
* The type of token. Field reserved for RFC compliance. See https://www.rfc-editor.org/rfc/rfc6749#section-5.1 Note: No token_type is returned for current implementation
|
|
215
|
+
*/
|
|
216
|
+
token_type?: string | null;
|
|
217
|
+
}
|
|
160
218
|
/**
|
|
161
219
|
* Request message for ExchangeToken.
|
|
162
220
|
*/
|
|
@@ -372,7 +430,78 @@ export declare namespace sts_v1 {
|
|
|
372
430
|
introspect(params: Params$Resource$V1$Introspect, callback: BodyResponseCallback<Schema$GoogleIdentityStsV1IntrospectTokenResponse>): void;
|
|
373
431
|
introspect(callback: BodyResponseCallback<Schema$GoogleIdentityStsV1IntrospectTokenResponse>): void;
|
|
374
432
|
/**
|
|
375
|
-
* Exchanges a credential for a Google OAuth 2.0 access token.
|
|
433
|
+
* Exchanges a credential that represents the resource owner's authorization for a Google-generated [OAuth 2.0 access token] (https://www.rfc-editor.org/rfc/rfc6749#section-5) or [refreshes an accesstoken] (https://www.rfc-editor.org/rfc/rfc6749#section-6) following [the OAuth 2.0 authorization framework] (https://tools.ietf.org/html/rfc8693) The credential can be one of the following: - An authorization code issued by the workforce identity federation authorization endpoint - A [refresh token](https://www.rfc-editor.org/rfc/rfc6749#section-10.4) issued by this endpoint This endpoint is only meant to be called by the Google Cloud CLI. Also note that this API only accepts the authorization code issued for workforce pools.
|
|
434
|
+
* @example
|
|
435
|
+
* ```js
|
|
436
|
+
* // Before running the sample:
|
|
437
|
+
* // - Enable the API at:
|
|
438
|
+
* // https://console.developers.google.com/apis/api/sts.googleapis.com
|
|
439
|
+
* // - Login into gcloud by running:
|
|
440
|
+
* // `$ gcloud auth application-default login`
|
|
441
|
+
* // - Install the npm module by running:
|
|
442
|
+
* // `$ npm install googleapis`
|
|
443
|
+
*
|
|
444
|
+
* const {google} = require('googleapis');
|
|
445
|
+
* const sts = google.sts('v1');
|
|
446
|
+
*
|
|
447
|
+
* async function main() {
|
|
448
|
+
* const auth = new google.auth.GoogleAuth({
|
|
449
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
450
|
+
* scopes: [],
|
|
451
|
+
* });
|
|
452
|
+
*
|
|
453
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
454
|
+
* const authClient = await auth.getClient();
|
|
455
|
+
* google.options({auth: authClient});
|
|
456
|
+
*
|
|
457
|
+
* // Do the magic
|
|
458
|
+
* const res = await sts.oauthtoken({
|
|
459
|
+
* // Request body metadata
|
|
460
|
+
* requestBody: {
|
|
461
|
+
* // request body parameters
|
|
462
|
+
* // {
|
|
463
|
+
* // "clientId": "my_clientId",
|
|
464
|
+
* // "code": "my_code",
|
|
465
|
+
* // "codeVerifier": "my_codeVerifier",
|
|
466
|
+
* // "grantType": "my_grantType",
|
|
467
|
+
* // "redirectUri": "my_redirectUri",
|
|
468
|
+
* // "refreshToken": "my_refreshToken",
|
|
469
|
+
* // "scope": "my_scope"
|
|
470
|
+
* // }
|
|
471
|
+
* },
|
|
472
|
+
* });
|
|
473
|
+
* console.log(res.data);
|
|
474
|
+
*
|
|
475
|
+
* // Example response
|
|
476
|
+
* // {
|
|
477
|
+
* // "access_token": "my_access_token",
|
|
478
|
+
* // "expires_in": 0,
|
|
479
|
+
* // "refresh_token": "my_refresh_token",
|
|
480
|
+
* // "scope": "my_scope",
|
|
481
|
+
* // "token_type": "my_token_type"
|
|
482
|
+
* // }
|
|
483
|
+
* }
|
|
484
|
+
*
|
|
485
|
+
* main().catch(e => {
|
|
486
|
+
* console.error(e);
|
|
487
|
+
* throw e;
|
|
488
|
+
* });
|
|
489
|
+
*
|
|
490
|
+
* ```
|
|
491
|
+
*
|
|
492
|
+
* @param params - Parameters for request
|
|
493
|
+
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
494
|
+
* @param callback - Optional callback that handles the response.
|
|
495
|
+
* @returns A promise if used with async/await, or void if used with a callback.
|
|
496
|
+
*/
|
|
497
|
+
oauthtoken(params: Params$Resource$V1$Oauthtoken, options: StreamMethodOptions): GaxiosPromise<Readable>;
|
|
498
|
+
oauthtoken(params?: Params$Resource$V1$Oauthtoken, options?: MethodOptions): GaxiosPromise<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>;
|
|
499
|
+
oauthtoken(params: Params$Resource$V1$Oauthtoken, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
|
|
500
|
+
oauthtoken(params: Params$Resource$V1$Oauthtoken, options: MethodOptions | BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>, callback: BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>): void;
|
|
501
|
+
oauthtoken(params: Params$Resource$V1$Oauthtoken, callback: BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>): void;
|
|
502
|
+
oauthtoken(callback: BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>): void;
|
|
503
|
+
/**
|
|
504
|
+
* Exchanges a credential for a Google OAuth 2.0 access token. The token asserts an external identity within an identity pool, or it applies a Credential Access Boundary to a Google access token. Note that workforce pools do not support Credential Access Boundaries. When you call this method, do not send the `Authorization` HTTP header in the request. This method does not require the `Authorization` header, and using the header can cause the request to fail.
|
|
376
505
|
* @example
|
|
377
506
|
* ```js
|
|
378
507
|
* // Before running the sample:
|
|
@@ -448,6 +577,12 @@ export declare namespace sts_v1 {
|
|
|
448
577
|
*/
|
|
449
578
|
requestBody?: Schema$GoogleIdentityStsV1IntrospectTokenRequest;
|
|
450
579
|
}
|
|
580
|
+
export interface Params$Resource$V1$Oauthtoken extends StandardParameters {
|
|
581
|
+
/**
|
|
582
|
+
* Request body metadata
|
|
583
|
+
*/
|
|
584
|
+
requestBody?: Schema$GoogleIdentityStsV1ExchangeOauthTokenRequest;
|
|
585
|
+
}
|
|
451
586
|
export interface Params$Resource$V1$Token extends StandardParameters {
|
|
452
587
|
/**
|
|
453
588
|
* Request body metadata
|
package/build/v1.js
CHANGED
|
@@ -76,6 +76,36 @@ var sts_v1;
|
|
|
76
76
|
return (0, googleapis_common_1.createAPIRequest)(parameters);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
oauthtoken(paramsOrCallback, optionsOrCallback, callback) {
|
|
80
|
+
let params = (paramsOrCallback || {});
|
|
81
|
+
let options = (optionsOrCallback || {});
|
|
82
|
+
if (typeof paramsOrCallback === 'function') {
|
|
83
|
+
callback = paramsOrCallback;
|
|
84
|
+
params = {};
|
|
85
|
+
options = {};
|
|
86
|
+
}
|
|
87
|
+
if (typeof optionsOrCallback === 'function') {
|
|
88
|
+
callback = optionsOrCallback;
|
|
89
|
+
options = {};
|
|
90
|
+
}
|
|
91
|
+
const rootUrl = options.rootUrl || 'https://sts.googleapis.com/';
|
|
92
|
+
const parameters = {
|
|
93
|
+
options: Object.assign({
|
|
94
|
+
url: (rootUrl + '/v1/oauthtoken').replace(/([^:]\/)\/+/g, '$1'),
|
|
95
|
+
method: 'POST',
|
|
96
|
+
}, options),
|
|
97
|
+
params,
|
|
98
|
+
requiredParams: [],
|
|
99
|
+
pathParams: [],
|
|
100
|
+
context: this.context,
|
|
101
|
+
};
|
|
102
|
+
if (callback) {
|
|
103
|
+
(0, googleapis_common_1.createAPIRequest)(parameters, callback);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return (0, googleapis_common_1.createAPIRequest)(parameters);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
79
109
|
token(paramsOrCallback, optionsOrCallback, callback) {
|
|
80
110
|
let params = (paramsOrCallback || {});
|
|
81
111
|
let options = (optionsOrCallback || {});
|
package/build/v1.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1.js","sourceRoot":"","sources":["../v1.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,uDAAuD;AACvD,sDAAsD;AACtD,0DAA0D;AAC1D,oDAAoD;AACpD,4CAA4C;AAE5C,yDAe2B;AAG3B,IAAiB,MAAM,
|
|
1
|
+
{"version":3,"file":"v1.js","sourceRoot":"","sources":["../v1.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,uDAAuD;AACvD,sDAAsD;AACtD,0DAA0D;AAC1D,oDAAoD;AACpD,4CAA4C;AAE5C,yDAe2B;AAG3B,IAAiB,MAAM,CA60BtB;AA70BD,WAAiB,MAAM;IAgErB;;;;;;;;;;OAUG;IACH,MAAa,GAAG;QAId,YAAY,OAAsB,EAAE,MAA2B;YAC7D,IAAI,CAAC,OAAO,GAAG;gBACb,QAAQ,EAAE,OAAO,IAAI,EAAE;gBACvB,MAAM;aACP,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;gBAC5B,MAAM,GAAG,EAA8B,CAAC;gBACxC,OAAO,GAAG,EAAE,CAAC;aACd;YAED,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE;gBAC3C,QAAQ,GAAG,iBAAiB,CAAC;gBAC7B,OAAO,GAAG,EAAE,CAAC;aACd;YAED,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,6BAA6B,CAAC;YACjE,MAAM,UAAU,GAAG;gBACjB,OAAO,EAAE,MAAM,CAAC,MAAM,CACpB;oBACE,GAAG,EAAE,CAAC,OAAO,GAAG,WAAW,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC;oBAC1D,MAAM,EAAE,MAAM;iBACf,EACD,OAAO,CACR;gBACD,MAAM;gBACN,cAAc,EAAE,EAAE;gBAClB,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC;YACF,IAAI,QAAQ,EAAE;gBACZ,IAAA,oCAAgB,EACd,UAAU,EACV,QAAyC,CAC1C,CAAC;aACH;iBAAM;gBACL,OAAO,IAAA,oCAAgB,EACrB,UAAU,CACX,CAAC;aACH;QACH,CAAC;KACF;IAjcY,kBAAW,cAicvB,CAAA;AAoBH,CAAC,EA70BgB,MAAM,GAAN,cAAM,KAAN,cAAM,QA60BtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@googleapis/sts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "sts",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"ts-loader": "^9.0.0",
|
|
39
39
|
"typescript": "~4.8.4",
|
|
40
40
|
"webpack": "^5.0.0",
|
|
41
|
-
"webpack-cli": "^
|
|
41
|
+
"webpack-cli": "^5.0.0"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/v1.ts
CHANGED
|
@@ -210,6 +210,64 @@ export namespace sts_v1 {
|
|
|
210
210
|
*/
|
|
211
211
|
userProject?: string | null;
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Request message for ExchangeOauthToken
|
|
215
|
+
*/
|
|
216
|
+
export interface Schema$GoogleIdentityStsV1ExchangeOauthTokenRequest {
|
|
217
|
+
/**
|
|
218
|
+
* Optional. The client identifier for the OAuth 2.0 client that requested the provided token. It is REQUIRED when the [client] (https://www.rfc-editor.org/rfc/rfc6749#section-1.1) is not authenticating with the authorization server, i.e. when authentication method is [client authentication] (https://www.rfc-editor.org/rfc/rfc6749#section-3.2.1).
|
|
219
|
+
*/
|
|
220
|
+
clientId?: string | null;
|
|
221
|
+
/**
|
|
222
|
+
* Optional. The authorization code that was previously from workforce identity federation's `authorize` endpoint. Required if the flow is authorization code flow, i.e. if grant_type is 'authorization_code'
|
|
223
|
+
*/
|
|
224
|
+
code?: string | null;
|
|
225
|
+
/**
|
|
226
|
+
* Optional. The code verifier for the PKCE request, Google Cloud CLI originally generates it before the authorization request. PKCE is used to protect authorization code from interception attacks. See https://www.rfc-editor.org/rfc/rfc7636#section-1.1 and https://www.rfc-editor.org/rfc/rfc7636#section-3. It is required when the flow is authorization code flow, i.e. if grant_type is 'authorization_code'
|
|
227
|
+
*/
|
|
228
|
+
codeVerifier?: string | null;
|
|
229
|
+
/**
|
|
230
|
+
* Required. The grant types are as follows: - 'authorization_code' : an authorization code flow, i.e. exchange of authorization code for the Oauth access token - 'refresh_token' : a refresh token flow, i.e. obtain a new access token by providing the refresh token. See https://www.rfc-editor.org/rfc/rfc6749#section-6
|
|
231
|
+
*/
|
|
232
|
+
grantType?: string | null;
|
|
233
|
+
/**
|
|
234
|
+
* Optional. redirect_url is required when the flow is authorization code flow i.e. if grant_type is `authorization_code` See https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3
|
|
235
|
+
*/
|
|
236
|
+
redirectUri?: string | null;
|
|
237
|
+
/**
|
|
238
|
+
* Optional. The Refresh token is the credential that is used to obtain a new access token when the current access token becomes invalid or expires. Required when using refresh token flow, i.e. if `grant_type` is 'refresh_token' See https://www.rfc-editor.org/rfc/rfc6749#section-1.5 and https://www.rfc-editor.org/rfc/rfc6749#section-6
|
|
239
|
+
*/
|
|
240
|
+
refreshToken?: string | null;
|
|
241
|
+
/**
|
|
242
|
+
* Optional. An optional list of scopes that are requested for the token to be returned. See https://www.rfc-editor.org/rfc/rfc6749#section-3.3 Must be a list of space-delimited, case-sensitive strings. Note: Currently, the scopes in the request are not supported
|
|
243
|
+
*/
|
|
244
|
+
scope?: string | null;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Response message for ExchangeOauthToken. see https://www.rfc-editor.org/rfc/rfc6749#section-5.1
|
|
248
|
+
*/
|
|
249
|
+
export interface Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse {
|
|
250
|
+
/**
|
|
251
|
+
* An OAuth 2.0 security token, issued by Google, in response to the Oauth token exchange request for the authorization code and refresh token flows. The returned [access token](https://www.rfc-editor.org/rfc/rfc6749#section-4.1.4). Tokens can vary in size, depending, in part, on the size of mapped claims, up to a maximum of 12288 bytes (12 KB). Google reserves the right to change the token size and the maximum length at any time.
|
|
252
|
+
*/
|
|
253
|
+
access_token?: string | null;
|
|
254
|
+
/**
|
|
255
|
+
* The amount of time, in seconds, between the time when the access token was issued and the time when the access token will expires.
|
|
256
|
+
*/
|
|
257
|
+
expires_in?: number | null;
|
|
258
|
+
/**
|
|
259
|
+
* A refresh token, issued by Google, in response to the OAuth token exchange request for refresh token flow
|
|
260
|
+
*/
|
|
261
|
+
refresh_token?: string | null;
|
|
262
|
+
/**
|
|
263
|
+
* A list of scopes associated with the returned token.
|
|
264
|
+
*/
|
|
265
|
+
scope?: string | null;
|
|
266
|
+
/**
|
|
267
|
+
* The type of token. Field reserved for RFC compliance. See https://www.rfc-editor.org/rfc/rfc6749#section-5.1 Note: No token_type is returned for current implementation
|
|
268
|
+
*/
|
|
269
|
+
token_type?: string | null;
|
|
270
|
+
}
|
|
213
271
|
/**
|
|
214
272
|
* Request message for ExchangeToken.
|
|
215
273
|
*/
|
|
@@ -507,7 +565,156 @@ export namespace sts_v1 {
|
|
|
507
565
|
}
|
|
508
566
|
|
|
509
567
|
/**
|
|
510
|
-
* Exchanges a credential for a Google OAuth 2.0 access token.
|
|
568
|
+
* Exchanges a credential that represents the resource owner's authorization for a Google-generated [OAuth 2.0 access token] (https://www.rfc-editor.org/rfc/rfc6749#section-5) or [refreshes an accesstoken] (https://www.rfc-editor.org/rfc/rfc6749#section-6) following [the OAuth 2.0 authorization framework] (https://tools.ietf.org/html/rfc8693) The credential can be one of the following: - An authorization code issued by the workforce identity federation authorization endpoint - A [refresh token](https://www.rfc-editor.org/rfc/rfc6749#section-10.4) issued by this endpoint This endpoint is only meant to be called by the Google Cloud CLI. Also note that this API only accepts the authorization code issued for workforce pools.
|
|
569
|
+
* @example
|
|
570
|
+
* ```js
|
|
571
|
+
* // Before running the sample:
|
|
572
|
+
* // - Enable the API at:
|
|
573
|
+
* // https://console.developers.google.com/apis/api/sts.googleapis.com
|
|
574
|
+
* // - Login into gcloud by running:
|
|
575
|
+
* // `$ gcloud auth application-default login`
|
|
576
|
+
* // - Install the npm module by running:
|
|
577
|
+
* // `$ npm install googleapis`
|
|
578
|
+
*
|
|
579
|
+
* const {google} = require('googleapis');
|
|
580
|
+
* const sts = google.sts('v1');
|
|
581
|
+
*
|
|
582
|
+
* async function main() {
|
|
583
|
+
* const auth = new google.auth.GoogleAuth({
|
|
584
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
585
|
+
* scopes: [],
|
|
586
|
+
* });
|
|
587
|
+
*
|
|
588
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
589
|
+
* const authClient = await auth.getClient();
|
|
590
|
+
* google.options({auth: authClient});
|
|
591
|
+
*
|
|
592
|
+
* // Do the magic
|
|
593
|
+
* const res = await sts.oauthtoken({
|
|
594
|
+
* // Request body metadata
|
|
595
|
+
* requestBody: {
|
|
596
|
+
* // request body parameters
|
|
597
|
+
* // {
|
|
598
|
+
* // "clientId": "my_clientId",
|
|
599
|
+
* // "code": "my_code",
|
|
600
|
+
* // "codeVerifier": "my_codeVerifier",
|
|
601
|
+
* // "grantType": "my_grantType",
|
|
602
|
+
* // "redirectUri": "my_redirectUri",
|
|
603
|
+
* // "refreshToken": "my_refreshToken",
|
|
604
|
+
* // "scope": "my_scope"
|
|
605
|
+
* // }
|
|
606
|
+
* },
|
|
607
|
+
* });
|
|
608
|
+
* console.log(res.data);
|
|
609
|
+
*
|
|
610
|
+
* // Example response
|
|
611
|
+
* // {
|
|
612
|
+
* // "access_token": "my_access_token",
|
|
613
|
+
* // "expires_in": 0,
|
|
614
|
+
* // "refresh_token": "my_refresh_token",
|
|
615
|
+
* // "scope": "my_scope",
|
|
616
|
+
* // "token_type": "my_token_type"
|
|
617
|
+
* // }
|
|
618
|
+
* }
|
|
619
|
+
*
|
|
620
|
+
* main().catch(e => {
|
|
621
|
+
* console.error(e);
|
|
622
|
+
* throw e;
|
|
623
|
+
* });
|
|
624
|
+
*
|
|
625
|
+
* ```
|
|
626
|
+
*
|
|
627
|
+
* @param params - Parameters for request
|
|
628
|
+
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
629
|
+
* @param callback - Optional callback that handles the response.
|
|
630
|
+
* @returns A promise if used with async/await, or void if used with a callback.
|
|
631
|
+
*/
|
|
632
|
+
oauthtoken(
|
|
633
|
+
params: Params$Resource$V1$Oauthtoken,
|
|
634
|
+
options: StreamMethodOptions
|
|
635
|
+
): GaxiosPromise<Readable>;
|
|
636
|
+
oauthtoken(
|
|
637
|
+
params?: Params$Resource$V1$Oauthtoken,
|
|
638
|
+
options?: MethodOptions
|
|
639
|
+
): GaxiosPromise<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>;
|
|
640
|
+
oauthtoken(
|
|
641
|
+
params: Params$Resource$V1$Oauthtoken,
|
|
642
|
+
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
643
|
+
callback: BodyResponseCallback<Readable>
|
|
644
|
+
): void;
|
|
645
|
+
oauthtoken(
|
|
646
|
+
params: Params$Resource$V1$Oauthtoken,
|
|
647
|
+
options:
|
|
648
|
+
| MethodOptions
|
|
649
|
+
| BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>,
|
|
650
|
+
callback: BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>
|
|
651
|
+
): void;
|
|
652
|
+
oauthtoken(
|
|
653
|
+
params: Params$Resource$V1$Oauthtoken,
|
|
654
|
+
callback: BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>
|
|
655
|
+
): void;
|
|
656
|
+
oauthtoken(
|
|
657
|
+
callback: BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>
|
|
658
|
+
): void;
|
|
659
|
+
oauthtoken(
|
|
660
|
+
paramsOrCallback?:
|
|
661
|
+
| Params$Resource$V1$Oauthtoken
|
|
662
|
+
| BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>
|
|
663
|
+
| BodyResponseCallback<Readable>,
|
|
664
|
+
optionsOrCallback?:
|
|
665
|
+
| MethodOptions
|
|
666
|
+
| StreamMethodOptions
|
|
667
|
+
| BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>
|
|
668
|
+
| BodyResponseCallback<Readable>,
|
|
669
|
+
callback?:
|
|
670
|
+
| BodyResponseCallback<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>
|
|
671
|
+
| BodyResponseCallback<Readable>
|
|
672
|
+
):
|
|
673
|
+
| void
|
|
674
|
+
| GaxiosPromise<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>
|
|
675
|
+
| GaxiosPromise<Readable> {
|
|
676
|
+
let params = (paramsOrCallback || {}) as Params$Resource$V1$Oauthtoken;
|
|
677
|
+
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
678
|
+
|
|
679
|
+
if (typeof paramsOrCallback === 'function') {
|
|
680
|
+
callback = paramsOrCallback;
|
|
681
|
+
params = {} as Params$Resource$V1$Oauthtoken;
|
|
682
|
+
options = {};
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
if (typeof optionsOrCallback === 'function') {
|
|
686
|
+
callback = optionsOrCallback;
|
|
687
|
+
options = {};
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const rootUrl = options.rootUrl || 'https://sts.googleapis.com/';
|
|
691
|
+
const parameters = {
|
|
692
|
+
options: Object.assign(
|
|
693
|
+
{
|
|
694
|
+
url: (rootUrl + '/v1/oauthtoken').replace(/([^:]\/)\/+/g, '$1'),
|
|
695
|
+
method: 'POST',
|
|
696
|
+
},
|
|
697
|
+
options
|
|
698
|
+
),
|
|
699
|
+
params,
|
|
700
|
+
requiredParams: [],
|
|
701
|
+
pathParams: [],
|
|
702
|
+
context: this.context,
|
|
703
|
+
};
|
|
704
|
+
if (callback) {
|
|
705
|
+
createAPIRequest<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>(
|
|
706
|
+
parameters,
|
|
707
|
+
callback as BodyResponseCallback<unknown>
|
|
708
|
+
);
|
|
709
|
+
} else {
|
|
710
|
+
return createAPIRequest<Schema$GoogleIdentityStsV1ExchangeOauthTokenResponse>(
|
|
711
|
+
parameters
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Exchanges a credential for a Google OAuth 2.0 access token. The token asserts an external identity within an identity pool, or it applies a Credential Access Boundary to a Google access token. Note that workforce pools do not support Credential Access Boundaries. When you call this method, do not send the `Authorization` HTTP header in the request. This method does not require the `Authorization` header, and using the header can cause the request to fail.
|
|
511
718
|
* @example
|
|
512
719
|
* ```js
|
|
513
720
|
* // Before running the sample:
|
|
@@ -661,6 +868,12 @@ export namespace sts_v1 {
|
|
|
661
868
|
*/
|
|
662
869
|
requestBody?: Schema$GoogleIdentityStsV1IntrospectTokenRequest;
|
|
663
870
|
}
|
|
871
|
+
export interface Params$Resource$V1$Oauthtoken extends StandardParameters {
|
|
872
|
+
/**
|
|
873
|
+
* Request body metadata
|
|
874
|
+
*/
|
|
875
|
+
requestBody?: Schema$GoogleIdentityStsV1ExchangeOauthTokenRequest;
|
|
876
|
+
}
|
|
664
877
|
export interface Params$Resource$V1$Token extends StandardParameters {
|
|
665
878
|
/**
|
|
666
879
|
* Request body metadata
|