title: How to use the AWS Python SDK while connecting via SSO credentials
body: <p>I am attempting to create a python script to connect to and interact with my AWS account. I was reading up on it here <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html" rel="noreferrer">https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html</a></p>
  
  <p>and I see that it reads your credentials from ~/.aws/credentials (on a Linux machine). I however and not connecting with an IAM user but SSO user. Thus, the profile connection data I use is located at ~/.aws/sso/cache directory.</p>
  
  <p>Inside that directory, I see two json files. One has the following keys:</p>
  
  <ul>
  <li>startUrl</li>
  <li>region</li>
  <li>accessToken</li>
  <li>expiresAt</li>
  </ul>
  
  <p>the second has the following keys:</p>
  
  <ul>
  <li>clientId</li>
  <li>clientSecret</li>
  <li>expiresAt</li>
  </ul>
  
  <p>I don't see anywhere in the docs about how to tell it to use my SSO user.</p>
  
  <p>Thus, when I try to run my script, I get error such as </p>
  
  <pre><code>botocore.exceptions.ClientError: An error occurred (AuthFailure) when calling the DescribeSecurityGroups operation: AWS was not able to validate the provided access credentials
  </code></pre>
  
  <p>even though I can run the same command fine from the command prompt.</p>