Why when I run the command...
aws --profile default sts get-caller-identity
it works and I get the expected result back. But when I attempt to run...
aws sts get-caller-identity
It fails with the error "An error occurred (ExpiredToken) when calling the GetCallerIdentity operation: The security token included in the request is expired"
I've configured aws sso correctly and have successfully given my machine permission. I've ensure that there are no AWS environment variables set in my user or system environment variables (no environment variable prefixed with 'AWS_')
Ok so thanks to @jarmod's comment on my question I was able to isolate the issue, by using the logs produced from the command:
which outputted:
So I ran the commands:
and reran the above command which gave me the output of:
Now when I run the command:
it works as expected.