While trying to access an api, receiving 400 with detail as an unauthorized client. It appears I am trying to send a bad request and somehow the response does not match the request or could be vice versa. Per my understanding, the api requires 5 input, [client_id=YOURCLIENTID , &client_secret=YOURCLIENTSECRET , &grant_type=refresh_token, &refresh_token=YOURREFRESHTOKEN , &scope=openid%20profile] .
Am I missing anything here?
Am I missing anything here?
Code:
***** Code snippet clientid = 'SUPERUSER_9-00_1062'; clientsc = 'giut67t9v76f9&kyygmpy789hmh87hm8jh8hp78g67g96'; comm = http_persist_open( URL:timeout); data='grant_type=client_credentials'+ '&scope=openid%20profile'; http_setAuth(HTTP_AUTH_NONE:'':''); http_xproc(HTTP_POINT_ADDL_HEADER: *null); http_xproc(HTTP_POINT_ADDL_HEADER:%paddr(addHeader s)); http_setAuth( HTTP_AUTH_BASIC : %trim(clientid) : %trim(clientcsc));http_persist_req(request:comm:UR L:sndFd:sndProc : %addr(data:*data) : %len(data) : rcvFd : rcvtkn :timeout : *omit : 'application/x-www-form-urlencoded' : *omit : *omit); *************** paddHeaders... p b d pi d headers 32567 varying d header_ptr * value d header ds likeds(header_temp) d based(header_ptr) d crlf c x'0d25' headers = 'Refresh_token:'+ '6568755555955587gftyfydr6758767ftyd54e56rfytviyte 65rfvuyi67ti5if'+CRLF; p e ****************** ############### Log http_persist_req(POST) entered. http_long_ParseURL(): entered http_long_ParseURL(): entered do_oper(POST): entered There are 0 cookies in the cache POST /connect/token HTTP/1.1 Host: [URL="http://mytestsite.gov/"]mytestsite.gov[/URL] User-Agent: http-api/1.39 Content-Type: application/x-www-form-urlencoded Expect: 100-continue Content-Length: 29 Authorization: Basic HHU88TGT6KKTF77FF87F66F7G87GGGGG89687TF6F6RN7 scope:openid%20profilen Refresh_token:6568755555955587gftyfydr6758767ftyd5 4e56rfytviyte65rfvuyi67ti5if recvresp(): entered HTTP/1.1 100 ContinueSetError() #13: HTTP/1.1 100 Continue recvresp(): end with 100 No content expected with 100 header_load_cookies() entered senddoc(): entered grant_type=client_credentials&scope=openid%20profile recvresp(): entered HTTP/1.1 400 Bad Request Cache-Control: no-store, no-cache, max-age=0 Pragma: no-cache Transfer-Encoding: chunked Content-Type: application/json; charset=UTF-8 Server: Kestrel X-Powered-By: [URL="http://asp.net/"]ASP.NET[/URL] chunk size = 31 get_chunk_size returned 31 calling comm_blockread {"error":"unauthorized_client"} comm_blockread returned 31
Comment