@@ -55,6 +55,10 @@ def endpoint
5555 @endpoint ||= API ::DEFAULT_ENDPOINT
5656 end
5757
58+ def oauth_endpoint
59+ @oauth_endpoint ||= API ::DEFAULT_OAUTH_ENDPOINT
60+ end
61+
5862 def blob_endpoint
5963 return @blob_endpoint if @blob_endpoint
6064
@@ -122,7 +126,7 @@ def issue_channel_access_token_21(jwt)
122126 client_assertion : jwt
123127 )
124128 headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
125- post ( endpoint , endpoint_path , payload , headers )
129+ post ( oauth_endpoint , endpoint_path , payload , headers )
126130 end
127131
128132 # Revoke channel access token v2.1
@@ -141,7 +145,7 @@ def revoke_channel_access_token_21(access_token)
141145 access_token : access_token
142146 )
143147 headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
144- post ( endpoint , endpoint_path , payload , headers )
148+ post ( oauth_endpoint , endpoint_path , payload , headers )
145149 end
146150
147151 # Get all valid channel access token key IDs v2.1
@@ -153,14 +157,14 @@ def get_channel_access_token_key_ids_21(jwt)
153157 channel_id_required
154158 channel_secret_required
155159
156- endpoint_path = '/oauth2/v2.1/tokens/kid'
157160 payload = URI . encode_www_form (
158- grant_type : 'client_credentials' ,
159161 client_assertion_type : 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer' ,
160162 client_assertion : jwt
161163 )
164+ endpoint_path = "/oauth2/v2.1/tokens/kid?#{ payload } "
165+
162166 headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
163- post ( endpoint , endpoint_path , payload , headers )
167+ get ( oauth_endpoint , endpoint_path , headers )
164168 end
165169
166170 # Push messages to a user using user_id.
0 commit comments