Skip to content

Commit 5d2bde8

Browse files
committed
v1.4.0
1 parent 369a63c commit 5d2bde8

File tree

3 files changed

+78
-12
lines changed

3 files changed

+78
-12
lines changed

src/apis/authorization-api.ts

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,15 @@ export const AuthorizationApiAxiosParamCreator = function (configuration?: Confi
4242
* @param {*} [options] Override http request option.
4343
* @throws {RequiredError}
4444
*/
45-
oAuthAuthorize: (responseType: string, clientId: string, redirectUri: string, state?: string, options: any = {}): RequestArgs => {
45+
oAuthAuthorize: (
46+
responseType: string,
47+
clientId: string,
48+
redirectUri: string,
49+
state?: string,
50+
codeChallenge?: string,
51+
codeChallengeMethod?: string,
52+
options: any = {}
53+
): RequestArgs => {
4654
// verify required parameter 'responseType' is not null or undefined
4755
assertParamExists('oAuthAuthorize', 'responseType', responseType)
4856
// verify required parameter 'clientId' is not null or undefined
@@ -77,6 +85,14 @@ export const AuthorizationApiAxiosParamCreator = function (configuration?: Confi
7785
localVarQueryParameter['state'] = state;
7886
}
7987

88+
if (codeChallenge !== undefined) {
89+
localVarQueryParameter['code_challenge'] = codeChallenge;
90+
localVarQueryParameter['code_challenge_method'] = 'S256';
91+
}
92+
93+
if (codeChallengeMethod !== undefined) {
94+
localVarQueryParameter['code_challenge_method'] = codeChallengeMethod;
95+
}
8096

8197
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
8298
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -174,6 +190,20 @@ export interface AuthorizationApiGetAuthorizationUrlSearchParams {
174190
* @memberof AuthorizationApiGetAuthorizationUrlSearchParams
175191
*/
176192
readonly state?: string
193+
194+
/**
195+
* RECOMMENDED. A PKCE code challenge derived from the code verifier, to be verified against later.
196+
* @type {string}
197+
* @memberof AuthorizationApiGetAuthorizationUrlSearchParams
198+
*/
199+
readonly codeChallenge?: string
200+
201+
/**
202+
* RECOMMENDED. PKCE code verifier transformation method.
203+
* @type {string}
204+
* @memberof AuthorizationApiGetAuthorizationUrlSearchParams
205+
*/
206+
readonly codeChallengeMethod?: string
177207
}
178208

179209

@@ -206,7 +236,13 @@ export interface AuthorizationApiCreateTokenParams {
206236
* @type {string}
207237
* @memberof AuthorizationApiCreateTokenParams
208238
*/
209-
clientSecret: string;
239+
clientSecret?: string;
240+
/**
241+
* A cryptographically random string that is used to correlate the authorization request to the token request
242+
* @type {string}
243+
* @memberof AuthorizationApiCreateTokenParams
244+
*/
245+
codeVerifier?: string;
210246
}
211247

212248

@@ -233,7 +269,13 @@ export interface AuthorizationApiRefreshTokenParams {
233269
* @type {string}
234270
* @memberof AuthorizationApiRefreshTokenParams
235271
*/
236-
clientSecret: string;
272+
clientSecret?: string;
273+
/**
274+
* A cryptographically random string that is used to correlate the authorization request to the token request
275+
* @type {string}
276+
* @memberof AuthorizationApiRefreshTokenParams
277+
*/
278+
codeVerifier?: string;
237279
}
238280

239281

@@ -256,7 +298,15 @@ export class AuthorizationApi extends BaseAPI {
256298
*/
257299
public getAuthorizationUrl(searchParams: AuthorizationApiGetAuthorizationUrlSearchParams, options?: any): string {
258300
const paramCreator = AuthorizationApiAxiosParamCreator(this.configuration);
259-
const params = paramCreator.oAuthAuthorize("code", searchParams.clientId, searchParams.redirectUri, searchParams.state, options);
301+
const params = paramCreator.oAuthAuthorize(
302+
"code",
303+
searchParams.clientId,
304+
searchParams.redirectUri,
305+
searchParams.state,
306+
searchParams.codeChallenge,
307+
searchParams.codeChallengeMethod,
308+
options
309+
);
260310
return this.axios.getUri({
261311
...params.options,
262312
url: this.basePath + params.url

src/models/token-create-authorization-code-body.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export const transformTokenCreateAuthorizationCodeBodyToJSON = function (value:
2020
code: value.code,
2121
redirect_uri: value.redirectUri,
2222
client_id: value.clientId,
23-
client_secret: value.clientSecret
23+
client_secret: value.clientSecret,
24+
code_verifier: value.codeVerifier
2425
}
2526
}
2627

@@ -30,7 +31,8 @@ export const transformJSONToTokenCreateAuthorizationCodeBody = function (value:
3031
code: value.code,
3132
redirectUri: value.redirect_uri,
3233
clientId: value.client_id,
33-
clientSecret: value.client_secret
34+
clientSecret: value.client_secret,
35+
codeVerifier: value.code_verifier
3436
}
3537
}
3638

@@ -65,11 +67,17 @@ export interface TokenCreateAuthorizationCodeBody {
6567
*/
6668
clientId: string;
6769
/**
68-
* The `client_secret` of your Zeplin app
70+
* The `client_secret` of your Zeplin app **Note**: `client_secret` is required for `code` values obtained without using a PKCE `code_challenge` value. **Warning**: `client_secret` property should only be used in a server-side application. If your Zeplin app is a public client, you should use PKCE authorization flow.
6971
* @type {string}
7072
* @memberof TokenCreateAuthorizationCodeBody
7173
*/
72-
clientSecret: string;
74+
clientSecret?: string;
75+
/**
76+
* A cryptographically random string that is used to correlate the authorization request to the token request
77+
* @type {string}
78+
* @memberof TokenCreateAuthorizationCodeBody
79+
*/
80+
codeVerifier?: string;
7381
}
7482

7583

src/models/token-create-refresh-token-body.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export const transformTokenCreateRefreshTokenBodyToJSON = function (value: Token
1919
grant_type: value.grantType,
2020
refresh_token: value.refreshToken,
2121
client_id: value.clientId,
22-
client_secret: value.clientSecret
22+
client_secret: value.clientSecret,
23+
code_verifier: value.codeVerifier
2324
}
2425
}
2526

@@ -28,7 +29,8 @@ export const transformJSONToTokenCreateRefreshTokenBody = function (value: any):
2829
grantType: value.grant_type,
2930
refreshToken: value.refresh_token,
3031
clientId: value.client_id,
31-
clientSecret: value.client_secret
32+
clientSecret: value.client_secret,
33+
codeVerifier: value.code_verifier
3234
}
3335
}
3436

@@ -57,11 +59,17 @@ export interface TokenCreateRefreshTokenBody {
5759
*/
5860
clientId: string;
5961
/**
60-
* The `client_secret` of your Zeplin app
62+
* The `client_secret` of your Zeplin app **Note**: `client_secret` is required for `code` values obtained without using a PKCE `code_challenge` value. **Warning**: `client_secret` property should only be used in a server-side application. If your Zeplin app is a public client, you should use PKCE authorization flow.
6163
* @type {string}
6264
* @memberof TokenCreateRefreshTokenBody
6365
*/
64-
clientSecret: string;
66+
clientSecret?: string;
67+
/**
68+
* A cryptographically random string that is used to correlate the authorization request to the token request
69+
* @type {string}
70+
* @memberof TokenCreateRefreshTokenBody
71+
*/
72+
codeVerifier?: string;
6573
}
6674

6775

0 commit comments

Comments
 (0)