trustpilot/node-trustpilot

client.authenticate not working

Sangath opened this issue · 4 comments

When I try client.authenticate for

return rp(/v1/private/business-units/${BussinessUnit.id}/reviews)

I get the response as

{ [Function]
get: [Function],
head: [Function],
post: [Function],
put: [Function],
patch: [Function],
del: [Function],
delete: [Function],
cookie: [Function],
jar: [Function],
defaults: [Function] }

I am expecting reviews as response. It was all good in the previous version of this package( I guess 1.1). Now after the update I am facing this issue. Can you please help me on this. am I missing something in the request body?

b-dur commented

Hi @Sangath I'll have a look at it and try to reproduce it locally.

Thank you @b-dur

b-dur commented

@Sangath Thanks for reaching out to us.
I figured out that our docs where not up to date.
The correct way is following

client.authenticate()
  .then(
    rp =>
      rp(/v1/private/business-units/${BussinessUnit.id}/reviews));

Thanks @b-dur , Its works now :)