Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

API authentication issue

Avatar

Avatar
Validate 1
Level 1
Ramaswami
Level 1

Likes

0 likes

Total Posts

100 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
Ramaswami
Level 1

Likes

0 likes

Total Posts

100 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile
Ramaswami
Level 1

13-08-2020

Hi folks, 

 

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

 

Results = {"reason":"Unknown grant_type"}

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

 

script : 

 

var http = new HttpClientRequest("https://api.trustpilot.com/v1/oauth/oauth-business-users-for-applications/accesstoken")

var buffer = new MemoryBuffer()
buffer.fromString("hrIrJQO0rKQdWSf" + ':' + "AK4ceo", "iso-8859-1");
http.header["Content-Type"] = "application/x-www-form-urlencoded";
http.header["Authorization"] = "Basic " + buffer.toBase64();
http.header["grant_type"] = "password";
http.header["username"] = "abc.com;
http.header["password"] = "PaneL321!@";
http.body = "grant_type=password&username=abc.com&password=PanesddL321!@";
http.method = "GET"

http.execute()

var result = http.response.body.toString();
logInfo("Results = " + result)

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
_Manoj_Kumar
MVP

Likes

111 likes

Total Posts

310 posts

Correct Reply

97 solutions
Top badges earned
Validate 1
Contributor
Ignite 1
Shape 1
Give Back 5
View profile

Avatar
Validate 1
MVP
_Manoj_Kumar
MVP

Likes

111 likes

Total Posts

310 posts

Correct Reply

97 solutions
Top badges earned
Validate 1
Contributor
Ignite 1
Shape 1
Give Back 5
View profile
_Manoj_Kumar
MVP

14-08-2020

Hello @Ramaswami 

First change the http.method to POST then

try removing these 3 headers from your request.

 

 

http.header["grant_type"] = "password";
http.header["username"] = "abc.com;
http.header["password"] = "PaneL321!@";

 

 

According to the official trust pilot documentation, It is only accepting the authorization header,content Type and the Form data.

 

Also, you can refer to this documentation for additional troubleshooting: https://developers.trustpilot.com/authentication

 

Let me know if that works.

Thanks,

 

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 2
amritakedia_epsilon
Level 2

Likes

5 likes

Total Posts

50 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back
Boost 5
View profile

Avatar
Validate 1
Level 2
amritakedia_epsilon
Level 2

Likes

5 likes

Total Posts

50 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back
Boost 5
View profile
amritakedia_epsilon
Level 2

13-08-2020

Make sure there is no firewall blocking