Problem with Rest Messgae OAuth2 Profile

ceskie
Kilo Guru

Hello community,

I am setting up a REST Message with one POST method. This should use OAuth2 profile with Grant Type Client Credentials. My URL and credentials are correct. However, when I try to test the REST Method, I am getting following error:

The request failed: java.net.SocketTimeoutException: connect timed out when posting to https://xxxxxxxxxx.service-now.com/nav_to.do?uri=oauth_entity.do?sys_id=1420f7bddb3e8794862f3318f49619d9%26syspa

I tried to run this method via script. I got this error:

Error: Problem retrieving authentication profile

Even though I have no typo in the profile name (and SNOW says the param is profile name, not sys_id).

I am sending my OAuth Profile and Rest Message attached. One more thing - when I click get oAuth token, this expiration date time is always the same as the date time I click it, eg. it expires instantly - might this be the problem?

Any suggestions are more than welcomed!

find_real_file.png

find_real_file.png

find_real_file.png

find_real_file.png

1 REPLY 1

Ct111
Tera Sage

Two conclusions from your issue

 

1) As you may suspect based on the name, the SocketTimeoutException is thrown when a timeout occurs during a read or acceptance message within a socket connection, this means there can be some issue at their end as well while sending the response.

 

 

2) Or your token keeps expiring after certain minute and you havent wrote code to refresh it

 

Check the below links for

1) Whether token has expired ?

https://community.servicenow.com/community?id=community_question&sys_id=c459e6a4db9ee30011762183ca96...

 

2) Refreshing the token

https://community.servicenow.com/community?id=community_question&sys_id=5b544769dbd8dbc01dcaf3231f96...

 

 

Mark my ANSWER as CORRECT and HELPFUL if it helps.