okta

Okta API - authn always returns Invalid Session


I'm trying to authenticate an user using the "authn" API:

POST MYACCOUNT.oktapreview.com/api/v1/authn
{
  "username": "email@gmail.com",
  "password" : "Password123"
}

But this always returns

{
    "errorCode": "E0000005",
    "errorSummary": "Invalid session",
    "errorLink": "E0000005",
    "errorId": "oael83e1QQxSNuHOlE0VkqBuA",
    "errorCauses": []
}

Any idea why this happens?

When I create the session, I just get a 403 - Forbidden error.

The sessions API works, but I want to use the authn API for a customized login experience.


Solution

  • The issue was because of the Authorization header in the Okta request.

    The Authorization header should be 'Authorization: SSWS API_TOKEN' Instead, I was just sending 'Authorization: API_TOKEN'