I'm using aws sso login, but I can't found out how to discover if I'm already logged in or if I need to login again, the only way I found to do that is to run a command I know I have permission and check that no errors happen.
aws sso logout
aws sqs list-queues # error
aws sso login # brower accept
aws sqs list-queues # success
My goal with that is to automate some scripts and only ask for login if needed.