Support Topics Documentation Slack YouTube Blog

User-token is always passed to own backend service?

I’ve deployed my own backend JS service and I’m calling it from the frontend with the block
image

  • I’m not passing a user token
  • I’m not using cookies to store user data on the client

What I’m observing though is, that my backend service can successfully execute

var currentUser = await Backendless.UserService.getCurrentUser();

currentUser is successfully determined if a user is logged-in although I’m not explicitly passing the user-token with the call from the frontend.

So, it seems that the user-token is passed to the backend no matter whether I’m deciding to do so, or not. What’s the purpose then of the user-token connector in the API Service block?

Regards,

Hello @Klaas_Klever

Yes, this input “user-token” is optional. By default it uses a token of the current user, however if you want to make as unauthorized user while there is a current user you can connect a null block to the input.

Regards, Vlad