All URIs are relative to https://subdomain.okta.com
Method | HTTP request | Description |
---|---|---|
createSession | POST /api/v1/sessions | Create a Session with Session Token |
endSession | DELETE /api/v1/sessions/{sessionId} | Delete a Session |
getSession | GET /api/v1/sessions/{sessionId} | Retrieve a Session |
refreshSession | POST /api/v1/sessions/{sessionId}/lifecycle/refresh | Refresh a Session |
Session createSession(createSessionRequest)
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 in order to delete a session via the API instead of visiting the logout URL.
import { okta } from '@okta/okta-sdk-nodejs';
import * as fs from 'fs';
const configuration = okta.createConfiguration();
const apiInstance = new okta.SessionApi(configuration);
let body:okta.SessionApiCreateSessionRequest = {
// CreateSessionRequest
createSessionRequest: {
sessionToken: "sessionToken_example",
},
};
apiInstance.createSession(body).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
createSessionRequest | CreateSessionRequest |
Session
| Status code | Description | Response headers | |————-|————-|——————| 200 | Success | - | 400 | Bad Request | - | 403 | Forbidden | - | 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
void endSession()
End a session.
import { okta } from '@okta/okta-sdk-nodejs';
import * as fs from 'fs';
const configuration = okta.createConfiguration();
const apiInstance = new okta.SessionApi(configuration);
let body:okta.SessionApiEndSessionRequest = {
// string
sessionId: "sessionId_example",
};
apiInstance.endSession(body).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
sessionId | [string] | defaults to undefined |
void
| Status code | Description | Response headers | |————-|————-|——————| 204 | No Content | - | 403 | Forbidden | - | 404 | Not Found | - | 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Session getSession()
Get details about a session.
import { okta } from '@okta/okta-sdk-nodejs';
import * as fs from 'fs';
const configuration = okta.createConfiguration();
const apiInstance = new okta.SessionApi(configuration);
let body:okta.SessionApiGetSessionRequest = {
// string
sessionId: "sessionId_example",
};
apiInstance.getSession(body).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
sessionId | [string] | defaults to undefined |
Session
| Status code | Description | Response headers | |————-|————-|——————| 200 | Success | - | 400 | Bad Request | - | 403 | Forbidden | - | 404 | Not Found | - | 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Session refreshSession()
Refresh a session.
import { okta } from '@okta/okta-sdk-nodejs';
import * as fs from 'fs';
const configuration = okta.createConfiguration();
const apiInstance = new okta.SessionApi(configuration);
let body:okta.SessionApiRefreshSessionRequest = {
// string
sessionId: "sessionId_example",
};
apiInstance.refreshSession(body).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
sessionId | [string] | defaults to undefined |
Session
| Status code | Description | Response headers | |————-|————-|——————| 200 | Success | - | 403 | Forbidden | - | 404 | Not Found | - | 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]