@@ -96,10 +96,15 @@ export class ChannelAccessTokenClient {
9696 clientSecret ?: string ,
9797 ) : Promise < IssueShortLivedChannelAccessTokenResponse > {
9898 const formParams = {
99- grantType : grantType ,
100- clientId : clientId ,
101- clientSecret : clientSecret ,
99+ grant_type : grantType ,
100+ client_id : clientId ,
101+ client_secret : clientSecret ,
102102 } ;
103+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
104+ if ( formParams [ key ] === undefined ) {
105+ delete formParams [ key ] ;
106+ }
107+ } ) ;
103108
104109 const res =
105110 this . httpClient . postForm < IssueShortLivedChannelAccessTokenResponse > (
@@ -122,10 +127,15 @@ export class ChannelAccessTokenClient {
122127 clientAssertion ?: string ,
123128 ) : Promise < IssueChannelAccessTokenResponse > {
124129 const formParams = {
125- grantType : grantType ,
126- clientAssertionType : clientAssertionType ,
127- clientAssertion : clientAssertion ,
130+ grant_type : grantType ,
131+ client_assertion_type : clientAssertionType ,
132+ client_assertion : clientAssertion ,
128133 } ;
134+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
135+ if ( formParams [ key ] === undefined ) {
136+ delete formParams [ key ] ;
137+ }
138+ } ) ;
129139
130140 const res = this . httpClient . postForm < IssueChannelAccessTokenResponse > (
131141 "/oauth2/v2.1/token" ,
@@ -151,12 +161,17 @@ export class ChannelAccessTokenClient {
151161 clientSecret ?: string ,
152162 ) : Promise < IssueStatelessChannelAccessTokenResponse > {
153163 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 ,
159169 } ;
170+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
171+ if ( formParams [ key ] === undefined ) {
172+ delete formParams [ key ] ;
173+ }
174+ } ) ;
160175
161176 const res =
162177 this . httpClient . postForm < IssueStatelessChannelAccessTokenResponse > (
@@ -175,8 +190,13 @@ export class ChannelAccessTokenClient {
175190 accessToken ?: string ,
176191 ) : Promise < Types . MessageAPIResponseBase > {
177192 const formParams = {
178- accessToken : accessToken ,
193+ access_token : accessToken ,
179194 } ;
195+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
196+ if ( formParams [ key ] === undefined ) {
197+ delete formParams [ key ] ;
198+ }
199+ } ) ;
180200
181201 const res = this . httpClient . postForm ( "/v2/oauth/revoke" , formParams ) ;
182202 return ensureJSON ( res ) ;
@@ -195,10 +215,15 @@ export class ChannelAccessTokenClient {
195215 accessToken ?: string ,
196216 ) : Promise < Types . MessageAPIResponseBase > {
197217 const formParams = {
198- clientId : clientId ,
199- clientSecret : clientSecret ,
200- accessToken : accessToken ,
218+ client_id : clientId ,
219+ client_secret : clientSecret ,
220+ access_token : accessToken ,
201221 } ;
222+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
223+ if ( formParams [ key ] === undefined ) {
224+ delete formParams [ key ] ;
225+ }
226+ } ) ;
202227
203228 const res = this . httpClient . postForm ( "/oauth2/v2.1/revoke" , formParams ) ;
204229 return ensureJSON ( res ) ;
@@ -213,8 +238,13 @@ export class ChannelAccessTokenClient {
213238 accessToken ?: string ,
214239 ) : Promise < VerifyChannelAccessTokenResponse > {
215240 const formParams = {
216- accessToken : accessToken ,
241+ access_token : accessToken ,
217242 } ;
243+ Object . keys ( formParams ) . forEach ( ( key : keyof typeof formParams ) => {
244+ if ( formParams [ key ] === undefined ) {
245+ delete formParams [ key ] ;
246+ }
247+ } ) ;
218248
219249 const res = this . httpClient . postForm < VerifyChannelAccessTokenResponse > (
220250 "/v2/oauth/verify" ,
0 commit comments