Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where can I get the sessionToken in a Parse.Function ? #5508

Closed
oallouch opened this issue Apr 15, 2019 · 8 comments
Closed

Where can I get the sessionToken in a Parse.Function ? #5508

oallouch opened this issue Apr 15, 2019 · 8 comments
Labels
type:question Support or code-level question

Comments

@oallouch
Copy link
Contributor

Hi,
I can't find in the docs the official way to retrieve the sessionToken from a request object.
I personally use request.query.sessionToken, but I see a lot of user.getSessionToken() in the source (it's not in the docs).

Thx,
Olivier

@oallouch oallouch changed the title We can I get the sessionToken in a Parse.Function ? Where can I get the sessionToken in a Parse.Function ? Apr 15, 2019
@rihadavid
Copy link
Contributor

rihadavid commented Apr 15, 2019

Might request.user.getSessionToken() be what you need?
BTW, code level questions should be asked on Stack Overflow using the parse-platform tag, not here 😉

@oallouch
Copy link
Contributor Author

The issue is really about the missing getSessionToken method in the docs.
https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html

@oallouch
Copy link
Contributor Author

If you tell me where to write this little piece of doc, I can do it. Is it a function comments ? How frequently do you generate the docs ?

@dplewis
Copy link
Member

dplewis commented Apr 19, 2019

@oallouch Its a function comment in the JS SDK.

Use npm run docs to verify the changes. The files are in the /out folder.

The docs are generate automatically after every PR is submitted

@oallouch
Copy link
Contributor Author

Great ! I'll give it a shot (for this one and the readPreference thing)

@acinader
Copy link
Contributor

https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Session.html#getSessionToken

that's not what you're looking for? What am I missing?

@oallouch
Copy link
Contributor Author

It might also work.
The real issue are the docs.
I see 3 solutions :
. request.query.sessionToken : this is what I use, but I don't see any 'query' in https://github.com/parse-community/Parse-SDK-JS/blob/master/src/CloudCode.js , but it's in the source


. request.user.getSessionToken() : this is the one I can see in the docs. I missed it because the generated html isn't alphabetically sorted ... and because I'm stupid :)
. through the Session : this one I don't know where to get (except by querying it)

So, from now on, I'll use user.getSessionToken() .
I also think using sessionToken as a query.find parameter should be made more important in the docs. Maybe a 'user' parameter would make it more obvious.

Anyway, thank you (a lot) for your clarifications.
Olivier

@mtrezza
Copy link
Member

mtrezza commented Nov 2, 2020

I'm closing this as it seems to be resolved. Feel free to comment if you have any questions and we can re-open this issue.

@mtrezza mtrezza closed this as completed Nov 2, 2020
@mtrezza mtrezza added 🔧 troubleshooting and removed type:docs Only change in the docs or README labels Nov 2, 2020
@mtrezza mtrezza added type:question Support or code-level question and removed 🔧 troubleshooting labels Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

5 participants