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.
Notes:
- Some browsers block third-party cookies by default, which disrupts Okta functionality in certain flows. See Mitigate the impact of third-party cookie deprecation.
- The Sessions API doesn't support direct authentication. Direct authentication is supported through the Authentication API or through OIDC using the Resource Owner Password flow.
Okta uses an HTTP session cookie to provide access to your Okta organization and applications across web requests for an interactive user agent such as a web browser. A session cookie has an expiration configurable by an administrator for the organization and is valid until the cookie expires or the user closes the Session (logout) or browser application.
A session token is a one-time bearer token that provides proof of authentication and may be redeemed for an interactive SSO session in Okta in a user agent. Session tokens can only be used once to establish a Session for a user and are revoked when the token expires.
Okta provides a very rich Authentication API to validate a user's primary credentials and secondary MFA factor. A session token is returned after successful authentication, which can be later exchanged for a session cookie that uses one of the following flows:
Note: Session tokens are secrets and should be protected at rest and during transit. A session token for a user is equivalent to having the user's actual credentials.
Creates a new Session for a user with a valid session token. Use this API if, for example, you want to set the session cookie yourself instead of allowing Okta to set it, or want to hold the session ID to delete a session through the API instead of visiting the logout URL.
Success
Bad Request
Forbidden
Too Many Requests
{- "sessionToken": "00HiohZYpJgMSHwmL9TQy7RRzuY-q9soKp1SPmYYow"
}
{- "amr": [
- "pwd"
], - "createdAt": "2019-08-24T14:15:22Z",
- "expiresAt": "2019-08-24T14:15:22Z",
- "id": "l7FbDVqS8zHSy65uJD85",
- "idp": {
- "id": "01a2bcdef3GHIJKLMNOP",
- "type": "ACTIVE_DIRECTORY"
}, - "lastFactorVerification": "2019-08-24T14:15:22Z",
- "lastPasswordVerification": "2019-08-24T14:15:22Z",
- "login": "user@example.com",
- "status": "ACTIVE",
- "userId": "00u0abcdefGHIJKLMNOP",
- "_links": {
- "self": {
- "hints": {
- "allow": [
- "DELETE"
]
}
},
}
}
Retrieves Session information for the current user. Use this method in a browser-based application to determine if the user is signed in.
Note: This operation requires a session cookie for the user. An API token isn't allowed for this operation.
Success
Not Found
{- "amr": [
- "pwd"
], - "createdAt": "2019-08-24T14:15:22Z",
- "expiresAt": "2019-08-24T14:15:22Z",
- "id": "l7FbDVqS8zHSy65uJD85",
- "idp": {
- "id": "01a2bcdef3GHIJKLMNOP",
- "type": "ACTIVE_DIRECTORY"
}, - "lastFactorVerification": "2019-08-24T14:15:22Z",
- "lastPasswordVerification": "2019-08-24T14:15:22Z",
- "login": "user@example.com",
- "status": "ACTIVE",
- "userId": "00u0abcdefGHIJKLMNOP",
- "_links": {
- "self": {
- "hints": {
- "allow": [
- "GET",
- "DELETE"
]
},
}, - "refresh": {
- "hints": {
- "allow": [
- "POST"
]
},
}, - "user": {
- "hints": {
- "allow": [
- "GET"
]
}, - "name": "User Name"
}
}
}
Closes the Session for the user who is currently signed in. Use this method in a browser-based application to sign out a user.
Note: This operation requires a session cookie for the user. An API token isn't allowed for this operation.
No Content
Not Found
{- "errorCode": "E0000007",
- "errorSummary": "Not found: {0}",
- "errorLink": "E0000007",
- "errorId": "sampleMlLvGUj_YD5v16vkYWY",
- "errorCauses": [ ]
}
Refreshes the Session for the current user
Note: This operation requires a session cookie for the user. An API token isn't allowed for this operation.
Success
Not Found
{- "amr": [
- "pwd"
], - "createdAt": "2019-08-24T14:15:22Z",
- "expiresAt": "2019-08-24T14:15:22Z",
- "id": "l7FbDVqS8zHSy65uJD85",
- "idp": {
- "id": "01a2bcdef3GHIJKLMNOP",
- "type": "ACTIVE_DIRECTORY"
}, - "lastFactorVerification": "2019-08-24T14:15:22Z",
- "lastPasswordVerification": "2019-08-24T14:15:22Z",
- "login": "user@example.com",
- "status": "ACTIVE",
- "userId": "00u0abcdefGHIJKLMNOP",
- "_links": {
- "self": {
- "hints": {
- "allow": [
- "GET",
- "DELETE"
]
},
}, - "refresh": {
- "hints": {
- "allow": [
- "POST"
]
},
}, - "user": {
- "hints": {
- "allow": [
- "GET"
]
}, - "name": "User Name"
}
}
}
okta.sessions.read
Retrieves information about the Session specified by the given session ID
Success
Bad Request
Forbidden
Not Found
Too Many Requests
{- "amr": [
- "pwd"
], - "createdAt": "2019-08-24T14:15:22Z",
- "expiresAt": "2019-08-24T14:15:22Z",
- "id": "l7FbDVqS8zHSy65uJD85",
- "idp": {
- "id": "01a2bcdef3GHIJKLMNOP",
- "type": "ACTIVE_DIRECTORY"
}, - "lastFactorVerification": "2019-08-24T14:15:22Z",
- "lastPasswordVerification": "2019-08-24T14:15:22Z",
- "login": "user@example.com",
- "status": "ACTIVE",
- "userId": "00u0abcdefGHIJKLMNOP",
- "_links": {
- "self": {
- "hints": {
- "allow": [
- "DELETE"
]
}
},
}
}
okta.sessions.manage
Revokes the specified Session
No Content
Forbidden
Not Found
Too Many Requests
{- "errorCode": "E0000006",
- "errorSummary": "You do not have permission to perform the requested action",
- "errorLink": "E0000006",
- "errorId": "sampleNUSD_8fdkFd8fs8SDBK",
- "errorCauses": [ ]
}
okta.sessions.manage
Refreshes an existing Session using the id
for that Session. A successful response contains the refreshed Session with an updated expiresAt
timestamp.
Success
Forbidden
Not Found
Too Many Requests
{- "amr": [
- "pwd"
], - "createdAt": "2019-08-25T14:17:22Z",
- "expiresAt": "2019-08-25T14:17:22Z",
- "id": "l7FbDVqS8zHSy65uJD85",
- "idp": {
- "id": "01a2bcdef3GHIJKLMNOP",
- "type": "ACTIVE_DIRECTORY"
}, - "lastFactorVerification": "2019-08-24T14:15:22Z",
- "lastPasswordVerification": "2019-08-24T14:15:22Z",
- "login": "user@example.com",
- "status": "ACTIVE",
- "userId": "00u0abcdefGHIJKLMNOP",
- "_links": {
- "self": {
- "hints": {
- "allow": [
- "DELETE"
]
}
},
}
}