@@ -96,10 +96,15 @@ export class ChannelAccessTokenClient {
96
96
clientSecret ?: string ,
97
97
) : Promise < IssueShortLivedChannelAccessTokenResponse > {
98
98
const formParams = {
99
- grantType : grantType ,
100
- clientId : clientId ,
101
- clientSecret : clientSecret ,
99
+ grant_type : grantType ,
100
+ client_id : clientId ,
101
+ client_secret : clientSecret ,
102
102
} ;
103
+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
104
+ if ( formParams [ key ] === undefined ) {
105
+ delete formParams [ key ] ;
106
+ }
107
+ } ) ;
103
108
104
109
const res =
105
110
this . httpClient . postForm < IssueShortLivedChannelAccessTokenResponse > (
@@ -122,10 +127,15 @@ export class ChannelAccessTokenClient {
122
127
clientAssertion ?: string ,
123
128
) : Promise < IssueChannelAccessTokenResponse > {
124
129
const formParams = {
125
- grantType : grantType ,
126
- clientAssertionType : clientAssertionType ,
127
- clientAssertion : clientAssertion ,
130
+ grant_type : grantType ,
131
+ client_assertion_type : clientAssertionType ,
132
+ client_assertion : clientAssertion ,
128
133
} ;
134
+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
135
+ if ( formParams [ key ] === undefined ) {
136
+ delete formParams [ key ] ;
137
+ }
138
+ } ) ;
129
139
130
140
const res = this . httpClient . postForm < IssueChannelAccessTokenResponse > (
131
141
"/oauth2/v2.1/token" ,
@@ -151,12 +161,17 @@ export class ChannelAccessTokenClient {
151
161
clientSecret ?: string ,
152
162
) : Promise < IssueStatelessChannelAccessTokenResponse > {
153
163
const formParams = {
154
- grantType : grantType ,
155
- clientAssertionType : clientAssertionType ,
156
- clientAssertion : clientAssertion ,
157
- clientId : clientId ,
158
- clientSecret : clientSecret ,
164
+ grant_type : grantType ,
165
+ client_assertion_type : clientAssertionType ,
166
+ client_assertion : clientAssertion ,
167
+ client_id : clientId ,
168
+ client_secret : clientSecret ,
159
169
} ;
170
+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
171
+ if ( formParams [ key ] === undefined ) {
172
+ delete formParams [ key ] ;
173
+ }
174
+ } ) ;
160
175
161
176
const res =
162
177
this . httpClient . postForm < IssueStatelessChannelAccessTokenResponse > (
@@ -175,8 +190,13 @@ export class ChannelAccessTokenClient {
175
190
accessToken ?: string ,
176
191
) : Promise < Types . MessageAPIResponseBase > {
177
192
const formParams = {
178
- accessToken : accessToken ,
193
+ access_token : accessToken ,
179
194
} ;
195
+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
196
+ if ( formParams [ key ] === undefined ) {
197
+ delete formParams [ key ] ;
198
+ }
199
+ } ) ;
180
200
181
201
const res = this . httpClient . postForm ( "/v2/oauth/revoke" , formParams ) ;
182
202
return ensureJSON ( res ) ;
@@ -195,10 +215,15 @@ export class ChannelAccessTokenClient {
195
215
accessToken ?: string ,
196
216
) : Promise < Types . MessageAPIResponseBase > {
197
217
const formParams = {
198
- clientId : clientId ,
199
- clientSecret : clientSecret ,
200
- accessToken : accessToken ,
218
+ client_id : clientId ,
219
+ client_secret : clientSecret ,
220
+ access_token : accessToken ,
201
221
} ;
222
+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
223
+ if ( formParams [ key ] === undefined ) {
224
+ delete formParams [ key ] ;
225
+ }
226
+ } ) ;
202
227
203
228
const res = this . httpClient . postForm ( "/oauth2/v2.1/revoke" , formParams ) ;
204
229
return ensureJSON ( res ) ;
@@ -213,8 +238,13 @@ export class ChannelAccessTokenClient {
213
238
accessToken ?: string ,
214
239
) : Promise < VerifyChannelAccessTokenResponse > {
215
240
const formParams = {
216
- accessToken : accessToken ,
241
+ access_token : accessToken ,
217
242
} ;
243
+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
244
+ if ( formParams [ key ] === undefined ) {
245
+ delete formParams [ key ] ;
246
+ }
247
+ } ) ;
218
248
219
249
const res = this . httpClient . postForm < VerifyChannelAccessTokenResponse > (
220
250
"/v2/oauth/verify" ,
0 commit comments