For demonstration purposes, I have created an API action - no actions attached. This demonstrates that all API actions will automatically carry the user ID
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.
I’ve been working on something a bit unrelated, stupidly I was looking for a users logged in cookie to see if they were logged in or not - Putting the Security provider up in the Global is waaay more efficient, I’m so glad I stumbled on this post - thanks @ben .
@jimed99 Looks like I’m not the only over thinker here