Expand my Community achievements bar.

SOLVED

API Authentication Issue

Avatar

Level 2

Hi All, 

i am writing a javascript code to get the access token from an API using grant_type = authorization_code but i am getting the below error : 

 

HTTP header 'WWW-Authenticate' used for proxy authentication not found.

 

var req = new HttpClientRequest("https://verticurlpartnersandbox.my.workfront.com/integrations/oauth2/api/v1/token");
var buffer = new MemoryBuffer()
buffer.fromString("359dff62b1b476c10a056edc20a8807a" + ':' + "Yh-7Vd031Ag0j-GqORsKJqfN6YhhN0c6RdkWRZSZUps", "utf-8");
req.header["Authorization"] = "Basic" + buffer.toBase64();
req.header["Content-Type"] = "application/x-www-form-urlencoded";
req.method = "POST";
var resBody = 'grant_type=authorization_code&redirect_uri=https://vrapidodev.verticurl.com/authTest/authCodeTest.php&code=655386c2c9fe50001dbc911c&client_id=3...';

req.body = resBody;
req.execute();

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

API
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @ignatius_dilip 

 

I believe you are missing the code key value pair in the body

The example given in the documentation here shows code is mandatory: Authorization code flow for custom OAuth 2 applications | Adobe Workfront


     Manoj
     Find me on LinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hello @ignatius_dilip 

 

I believe you are missing the code key value pair in the body

The example given in the documentation here shows code is mandatory: Authorization code flow for custom OAuth 2 applications | Adobe Workfront


     Manoj
     Find me on LinkedIn

Avatar

Level 2

Hi Manoj,

 

Thanks for the feedback. 

 

It is working fine now