Hello Everyone is there a way to check if the user...
# suitescript
s
Hello Everyone is there a way to check if the user is logged in when accessing a suitelet? or would you recommend a RESTlet for this?
b
users who can access the internal url of a suitelet are logged in
s
Yes but the idea is the the suitelet is available without loggin and check if they already are logged in, if they are not we'll show a credential form as a result and after they log in redirect them to a custom solution. If they are logged in redirect them with no credentials needed
b
the check is opening the internal url, in a window (or iframe) and seeing if you actually get your suitelet's content or a login screen
c
@battk Could they make a request to the internal URL and parse the response, perhaps using a different method e.g. POST and potentially a parameter. The response should be JSON if logged in, an HTML form if not?
b
cors is unlikely to allow you to make a post
c
GET then, maybe with a specific parameter to return a different response than the sign-in page.
b
if you are making a distinction between get or post, you are probably suggesting an xhr or fetch, both of which will likely fail at cors
the external url of a suitelet is not on the same domain as the internal url
c
@battk Oh, yep, you're right. I'd forgotten about them serving from different domains.