Cookie not set on external login

Hi,

I’m using Backendless with a Webflow site and the JS SDK. I’ve added a registration/login form to Webflow and can successfully login via the JS SDK and whilst the user-token gets set in the local storage (along with a Backendless_xxxx… about login persistence etc), I don’t get any cookie saved.

I have cookie-based authorisation turned on but it doesn’t seem to work.

I am including back endless in the header with…

<script type="application/javascript" src="https://api.backendless.com/sdk/js/latest/backendless.js" />

And am initialising with my app ID and the JS api key. I have a login form and this function to login…

var user = new Backendless.User();
	user.email = emailInput.value;
	user.password = passwordInput.value;

	Backendless.UserService.register( user ).then( userRegistered ).catch( gotError );

Which logs the user in correctly. Then I see a new entry in the cookie domains with a guid BUT there are no cookies for that entry. Subsequently trying to access a secure file via the URL fails with a permission error. If I refresh the page this empty ‘domain’ in the cookies list disappears until I log in again.

Can anyone help?


The API above is for registering a new user, to login you have to use another one:

const user = await Backendless.UserService.login( login, password, stayLoggedIn )

https://backendless.com/docs/js/users_login.html

Sorry, just I am using the login one, pasted the wrong one here. The issue still remains though that no cookie gets created. Has it got anything to do with my Webflow site being on a completely different domain?

Simon

@Simon_Lee

you should be on the same domain where you call login, and all subsequent requests

Ok so I have everything on the same root domain but still no cookie getting set. Can I send private messages to give you the URL’s to see what the issue is? I’m trialling this for a client and need to ensure this use case works.

Hello, @Simon_Lee.

Yes, please try to send. We will look into it.

Regards, Nikita.

Can I get an update on this please? I sent the links privately to you.

I saw we’re doing it, give us some time.

Can I at least check if this is supposed to work with the JS SDK on an external site (like Webflow or Wordpress etc)? If not then I’ll need to use Amazon S3 for file storage and secure URL’s via Cloudfront.

I’ve sent updated URL and login credentials via DM.

@Simon_Lee ,

The problem in your case is caused by fact that your front is under different subdomain. Due to this auth cookie is ignored when it returned by “login” request.

We are currently investigating if it possible to fix this issue on the level of our SDK.

Regards, Andriy