The CreatorCon Call for Content is officially open! Get started here.

oauth_token.do empty response body

kevin131
Kilo Explorer

Hi Team,

I have been trying to request the access token, i have double checked my credentails and also made sure that the Oauth client id and secret are active, but I always get an empty response body

on commandline curl

curl -d "grant_type=password&client_id={client_id}&client_secret={client_secret}&username={username}&password={password}" https://{instancename}.service-now.com/oauth_token.do

on fiddler and RequestMaker

url: https://{instancename}.service-now.com/oauth_token.do

Request type: POST

request body: grant_type=password&client_id={client_id}&client_secret={client_secret}&username={username}&password={password}

Can someone please advise, why is the response 200 but the response body is empty. I never receive the accesstoken.

4 REPLIES 4

DUGGI
Giga Guru

Keshav,



Did you try using rest console?


Ravindrareddy_Srvicenow



The same request works fine with Rest Console... I am getting the access token in the Response Body.



How can there be different results for two http clients?


This time I tried the curl online tool to test the response, its still without the accesstoken



curl -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=password&client_id={client_id}&client_secret={client_secret}&username={username}&password={password}" https://{instanceurl}.service-now.com/oauth_token.do



Please advise how could I get this working on a curl request as I am having the same issue with the PHP that I am using for my integration requirement


Hi Keshav,



I am wondering if a -i flag for curl might help.



-i, --include


                          (HTTP) Include the HTTP-header in the   output.   The   HTTP-header


                          includes   things   like   server-name, date of the document, HTTP-


                          version and more...


Edit:


This is just a guess - possibly wrong 😉



Best Regards



Tony


tony.barratt


Hi Tony,



The option for -i provides me information on the request, which is a 200 OK which means there should be a response body.


But I do not see the access token yet.



HTTP/1.1 200 OK


Set-Cookie: JSESSIONID={xxx988A4F8896400D08FE};Secure; Path=/; HttpOnly


Set-Cookie: glide_user_route=glide.{xxx988A4F8896400D08FE};secure; Expi


res=Sun, 19-Dec-2083 23:32:56 GMT; Path=/; HttpOnly


Set-Cookie: glide_session_store={xxx988A4F8896400D08FE}; Expires=Tue, 0


1-Dec-2015 20:48:49 GMT; Path=/; HttpOnly


Content-Length: 0


Date: Tue, 01 Dec 2015 20:18:49 GMT


Server: ServiceNow


Set-Cookie: BIGipServerpool_{xxx988A4F8896400D08FE}=2692744714.38718.0000; path=/