Unable to create session using SessionToken in okta POST /sessions API call
<p>I was able to get the sessionToken using username and password. But, after that I want to create the session using POST call as follows in AngularJS. The angular (entire web app) is hosted on AWS S3.</p>

<pre><code>var session_data = { 'sessionToken' : My_session_Token}; 
$http({
       method: 'POST',
       url: 'https://myorg.okta.com/api/v1/sessions',
       data: session_data,
       headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
          }
       }).then(function(response) {
            console.log(response);
       });
</code></pre>

<p>The error I am getting is </p>

<pre><code>XMLHttpRequest cannot load https://myorg.okta.com/api/v1/sessions. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s3.amazonaws.com' is therefore not allowed access.
</code></pre>

<p>I have already added the CORS Allow origin header in Okta as well as S3 bucket.</p>

<p>When I try doing the following through terminal</p>

<pre><code>curl -v -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
  "sessionToken": "my_session_Token"
}' "https://myorg.okta.com/api/v1/sessions"
</code></pre>

<p>First time I get </p>

<pre><code>{"errorCode":"E0000005","errorSummary":"Invalid session","errorLink":"E0000005","errorId":"oaefADOnPONTDidUZYyrVc5rQ","errorCauses":[]}MAC-S014568:~
</code></pre>

<p>second time, because of sessionToken is one time use only I get following error</p>

<pre><code>{"errorCode":"E0000004","errorSummary":"Authentication failed","errorLink":"E0000004","errorId":"oaeI-KKSO-iRGSR1gmyUjBS8g","errorCauses":[]}MAC-S01
</code></pre>

<p><strong>I don't think the problem is because of the CORS header (Allow origin) as I have already added the origin.
Also, I cannot use SSWS {api_TOKEN} as my application is in angular and its risky to expose the api token. 
Any help will be highly appreciated</strong></p>