Support Topics Documentation Slack YouTube Blog

Inject token to sdk

Hello guys. How I can inject backendless user-token, received from our server, in sdk to be logged in?

Hello Petr,

After user is logged in, user token is saved to the backendless.headers dictionary.
Assuming you want to use your own token instead of generated by Backendless you can change it this way before making any other requests:

Obj-C:
[backendless.headers setObject:@"YOUR_USER_TOKEN" forKey:@"user-token"];

Swift:
Backendless.sharedInstance()?.headers["user-token"] = "YOUR-USER-TOKEN"

Regards,
Olha