Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Okta API - authn always returns Invalid Session

Tags:

api

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

POST MYACCOUNT.oktapreview.com/api/v1/authn
{
  "username": "[email protected]",
  "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.

Thanks for your help.

like image 353
Paramesh Avatar asked Dec 23 '14 20:12

Paramesh


People also ask

How does Okta maintain session?

Okta uses a cookie-based authentication mechanism to maintain a user's authentication Session across web requests. The Okta Sessions API provides operations to create and manage authentication Sessions for users in your Okta organization.

How do you get session cookies Okta?

After a session token is obtained, it can be passed into the OpenID Connect authorize endpoint to get an Okta session cookie. Executing this flow sets a cookie in the end user's browser and then redirects them back to the redirect_uri that is passed into the request.


1 Answers

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'

like image 195
Paramesh Avatar answered Nov 07 '22 13:11

Paramesh