title: What's a good way to obtain STS credentials with a SAML federated login via Okta for use in local command line tools?
body: <p>The Amazon Web Services API provides the <a href="http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithSAML.html" rel="noreferrer">AssumeRoleWithSAML</a> endpoint to allow a user to exchange a SAML assertion for a set of temporary API credentials from the AWS Security Token Service.</p>
  
  <p>A SAML provider, like <a href="https://www.okta.com/" rel="noreferrer">Okta</a>, will <a href="http://developer.okta.com/docs/getting_started/saml_guidance.html#planning-for-saml" rel="noreferrer">generate a SAML assertion after a user logs into their web UI</a> and Okta authenticates the user on that user's enterprise backend (e.g. enterprise LDAP).</p>
  
  <p>Typically this assertion is then relayed from the users browser onto another web service that accepts SAML assertions, the relying party, in order to authenticate the user to this third party (for example when using Okta federated login to enable a user to log into the AWS web console)</p>
  
  <p>What is the best way to enabled a federated user to authenticate with Okta, get an assertion, pass that assertion to STS and get back a set of temporary AWS API credentials that the user could then use with either the AWS command line tools, or with a local python boto script?</p>
  
  <ul>
  <li>Launch a web browser from a python tool using the <a href="https://docs.python.org/2/library/webbrowser.html" rel="noreferrer">Python webbrowser</a> module?</li>
  <li>What's a fluid way to get an assertion from a web browser into a form usable by a command line tool?</li>
  <li>Create a temporary <a href="https://ngrok.com/" rel="noreferrer">ngrok</a> tunnel to a locally running temporary webserver (e.g. an instance of <a href="http://flask.pocoo.org/" rel="noreferrer">flask</a> or <a href="http://bottlepy.org/docs/dev/index.html" rel="noreferrer">bottle</a>) for Okta to redirect the users web browser onto in order to deliver the assertion to some local code?</li>
  <li>How does one typically bridge the world of an interactive web page and local command line tools?</li>
  </ul>