The way that I would go about it - others may have a better idea.
- When a user is logged in, there will be a value inside the security identity. I therefore place the security identity in the workflows globals.
- For demonstration purposes, I have created an API action - no actions attached. This demonstrates that all API actions will automatically carry the user ID
- A server connect connect on the page is connected to the
test
API. This makes the user ID available to the page.
- When I want the user ID, I pick it from the data bindings.
If the user is not logged in, there will be no value for the user ID. You can use this fact to show a different button for users that are logged in to those that are not. Use a conditional region for this.
When a user is not logged in, the relevant button is clicked on. This can take the user to a login page. There are more elegant ways to handle this part. At least this will give you food for thought.