Get token Oauth 2.0 using mid server

Vasilis Anastas
Tera Expert

Hello, in servicenow I am trying to create a REST message. First I need a POST method in order to get the token. I have to do that with mid Server. When I do that through scirpt (background script, using RESTMessageV2,setMIDServer etc) everything works fine!

When I am trying to do that through System Web Services -> Outbound -> Rest Message, nothing works.

What's the process? Where I should get the token ? on the parent Rest Message or I have to create a post http method? And If I use Oauth 2 authentication type, I cant use mid server (the field is automatically hidden). With every test I've done , If I press Get OAuth Token, I receive below error. I have create Oauth profile and application registry with client id, client secret, token url etc.

VasilisAnastas_0-1769523515692.png

Any Idea on that? 

2 REPLIES 2

PoonkodiS
Mega Sage

Hi @Vasilis Anastas 

No need to create or post a method to  get a token

PoonkodiS_0-1769524216033.png

1.Need to remove  the post method for token

2.use default get method

3.make sure your endpoint is correct to get the data

PoonkodiS_1-1769524634379.png

Make sure in Appication registry of OAuth provider (Client id and Client secret) 

Regards,

Poonkodi

Hello @PoonkodiS , 
I have done this but still nothing. The problem is that I cant use mid server with this way. And I need it. With script everything works, so client id , client secret etc are all valid.