Unable to connect through nodejs library

api

#1

I use Asana node js library and i’m able to login via oauth and get bearer_token and refresh_token.
But i can’t make any further request, I’m getting the following error
"Unable to verify userError: No Authorization "


#2

Are you passing the token you obtained in the requests? Sorry if that seems a dumb question, I am playing the rubber duck!


#3

Hi @Siva_Subramanian, can you confirm that you’re on the latest version of our Node client library? v0.16.0 had a bug in it that prevented authentication, which was then fixed in v0.16.1.


#4

Yes i’m using v0.16.1
I use CLIENT.app.accessTokenFromCode to authenticate, and then i use CLIENT.users.me() and i couldn’t get any results


#5

Can you share a minimum piece of code that exhibits this error?

My next guess based on your last reply (and building off @Bastien_Siebman’s reply) is this: The accessTokenFromCode method does not save the OAuth access token to the client. Rather, the return value is the OAuth access token and refresh token, which you need to save and give to the client yourself on subsequent requests. Calling CLIENT.app.accessTokenFromCode(...) and then immediately calling CLIENT.users.me() will not send any authorization header in the request.