0

I have a Netsuite scheduled script that connects to Concurs API to revoke all tokens for a user but I am getting a response code of 400 Invalid parameter combination. I have tried many different ways of setting the parameters but, I am having no luck.

Concur's Documentation says that this is what the need:

ConsumerKey: The access token of which you wish to revoke all current and future access. User: The login Id of the token owner. Format:

POST https://{InstanceURL}/net2/oauth2/revoketoken.ashx?consumerKey={Consumer Key}&user={User}
Authorization: OAuth {Token}

Here is my code

 var headers = {};
 headers['Content-Type'] = 'application/json';
 headers['Accept'] = 'application/json';
 headers['Authorization'] = 'Basic ' + credentials;
 headers['X-ConsumerKey'] = key; 
 headers.Authorization = 'OAuth ' + token;

 var urlpassed='revoketoken.ashx?consumerKey='+ key +'&user=WebAdmin%40redfin.com';
 var revokeToken = nlapiRequestURL('https://concursolutions.com/net2/oauth2/revoketoken.ashx?consumerKey='+ key +'&user='+ user,'', headers, 'POST');
Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
kdub
  • 205
  • 1
  • 6
  • 14
  • Have you tried posting to the url via another method like using Postman, or another tool where you can test and inspect url responses? – TonyH Feb 27 '16 at 02:36

1 Answers1

0

As per Concur Docs you should add consumerKey and user as parameter as in the below code snippet:

nlapiRequestURL('https://www.concursolutions.com/net2/oauth2/revoketoken.ashx?consumerKey='
    + YOUR_CONSUMER_KEY + '&user=' + YOUR_LOGIN_USER_ID, 
  '', 
  {'Authorization': 'OAuth ' + token}, 'POST');

For the above code I got 200 OK in my case.

prasun
  • 7,073
  • 9
  • 41
  • 59
  • Thanks for your reply: I was doing everything correct but miss typed the URL leaving out "www." - stupid typo. – kdub Mar 01 '16 at 13:47