That said, ‘auth’ token changes when the same Experience user logs into ‘Kanarra’ on different PCs, so I didn’t know how to compare.
Correct, if you sign in as the same user on two separate devices, that will generate two valid auth tokens for that user (unless you are specifically invalidating all tokens when issuing the second one). That is pretty standard for web applications.
Actually, if APIs (Endpoints, not an Experience page) are getting HTTP traffic from different sources, would you have to utilize user / pword auth (of the Experience user) in url query string params no? That didn’t seem to work either (my other screenshots above, and pattern below).
I would recommend passing an authorization
header in your requests with the value of “Bearer USER_AUTH_TOKEN”, and you can pull that token from the authorization
cookie. Though it too is encrpyted over https, the query string exposes the token in plain text to anybody who sees the browser bar and also in any server logs. This article covers the topic well.
If you need a little more guidance on how to set the auth token in a cookie and utilize it in asynchronous requests to an experience API, I recommend checking out the React.js Boilerplate template.
On the flip side for losant.token (from cookies when an Experience user logs into ‘Kanarra’), are you saying that is similar to how a Losant user generates a token in app GUI at bottom of sidebar?
losant.token
is issued by accounts.losant.com
when you sign in, and we issue the cookie with the domain
property of “losant.com”. Since “app.losant.com” (the user interface) and “api.losant.com” (the API root) share the same root domain, and since we issue the cookie with that “domain” property, the cookie is expose to those subdomains. (You can read more about this here.)
The reason you are seeing losant.token
show up when looking at your experience is because you are loading in a Losant dashboard through a Dashboard Experience Page. If you view the page source, you’ll see that scripts pulling from app.losant.com
are in the markup - and by loading these scripts from that domain, your browser is making the cookie available.
I take it losant.token is supposed to be more ‘global’ for the Losant RESTful API (permissions controlled by Losant vs Experience user).
The cookie from losant.token
can only be used to authenticate requests as your Losant user account against the Losant API. The Experience User has no permissions to access the Losant API directly; rather, that token (the authorization
cookie) authenticates against your experience endpoints only.