Skip to content

Load user from sessionToken in nodejs #679

@Jauny

Description

@Jauny

Hi,

I'm trying to find the best way to load/auth a user from a sessionToken. Only way I've found so far is to use the http api to call /users/me with X-Parse-Application-Id and X-Parse-Session-Token headers.
I've seen conflicting answers about having to add a X-Parse-REST-API-Key (including on the official docs). Our parse-server is started without a rest-api-key so I should not need one.

The call I'm doing then is the following:

curl -X GET \
  -H "X-Parse-Application-Id: <appId>" \
  -H "X-Parse-Session-Token: <token>" \
  https://<url>/parse/users/me

I'm getting {"error":"unauthorized"} without additional information so I don't know what the issue is.

I'm using both the parse/node on nodejs and parse lib in the browser. The parse lib offers a Parse.User.become(token) function which works, but I'm wondering why there is not an equivalent function from the nodejs lib. All I need is a getUserFromToken or equivalent.

I've seen that there was a Parse.Cloud.httpRequest but it got removed from the nodejs lib. I'm using axios for the call (or as I told simply curl to test) and this is not working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions