I installed the extension AWS Toolkit for VScode. My IAM Identity Center Users, Groups, etc were all created in us-east-2.

But for some reason AWS keeps trying to route me through us-east-1 even though this causes an invalid_grant Invalid grant provided error. I tried setting the region for AWS Toolkit to us-east-2:

After setting the region to us-east-2, I tried to connect via AWS Identity Center.

But it still directs me to https://device.sso.us-east-1.amazonaws.com/ to enter in my auth code. Notice the us-east-1 in the url instead of us-east-2. When I enter in the auth code, I get the dreaded invalid_grant Invalid grant provided error:

So how do I force it to use us-east-2 instead of us-east-2? It seems to ignore the fact that I set the region to us-east-2.

It looks like you are trying to use a credentials profile configured to use AWS IAM Identity Center (AWS SSO). This profile may not be configured to refer to the region where your SSO portal is defined.
Check your credentials files (
~/.aws/credentialsand/or~/.aws/config) for the credentials profile of interest. This profile should contain asso_regionproperty that is assigned to the region where your SSO portal is (us-east-2in your case).