Fetch UWL Session Information
Fetch UWL Session Information
When a session is created using the SDK, a unique session ID is created. Users can fetch details for a previously created UWL session by passing the session ID to a function call.
Parameters
dns
(required): Your BlockID tenant domain as shown in the dashboardcommunityName
(required): Your BlockID tenant community as shown in the dashboardlicenseKey
(required): BlockID license key as shown in the dashboardsessionId
(required): UWL session ID string (required)
Request Format
- NodeJS SDK
- Set tenant info and fetch details for existing UWL session
const BIDSessions = require('blockid-nodejs-helpers/BIDSessions');
let sessionInfo = await BIDSessions.fetchSessionInfo({ dns: "<dns>", communityName: "<communityName>", licenseKey: "<licenseKey>" }, <sessionId>);
Example UWL Request
For this exampe, we are first creating a UWL session in order to show the complete request cycle. Your UWL session ID will expire 120 seconds from its creation time.
- NodeJS SDK
Example - Fetch UWL Session Information
- Set tenant info, define metadata, and create UWL session
const BIDSessions = require('blockid-nodejs-helpers/BIDSessions');
// Optional: Define metadata. Users can pass "null" if defining metadata is not desired
let metadata = {
"purpose": "authentication"
}
let createdSessionResponse = await BIDSessions.createNewSession({ "dns": "blockid-trial.1kosmos.net", "communityName": "devx", "licenseKey": "0005c9f8-1918-40be-aa00-e319043f7xxx" }, null, null, metadata);
//Pass session ID for UWL session we just created (active for 120 seconds).
let sessionId = createdSessionResponse.sessionId;
let sessionInfo = await BIDSessions.fetchSessionInfo({ "dns": "blockid-trial.1kosmos.net", "communityName": "devx", "licenseKey": "0005c9f8-1918-40be-aa00-e319043f7xxx" }, sessionId);
Example Server Response
The SDK will return an immediate response from our API. The responses are the same across each SDK and are JSON formatted.
Server Responses
- 200
- 400 Expired
- 404 Session Doesn't Exist
200 OK
{
"sessionId": "b0ad6ca2-b148-4e1e-a857-3d7eb9978ce3",
"origin": {
"tag": "string",
"url": "https://blockid-trial.1kosmos.net/sessions",
"communityName": "devx",
"communityId": "5f3d8d0cd866fa61019cf969",
"authPage": "string"
},
"scopes": "string",
"authType": "string",
"metadata": {"purpose": "authentication"},
"createdTS": 0,
"expiryTS": 0,
"publicKey": "Uqyd3RgsZPYsVoeuVVkGwK+X7QLB9N6rDgSFiUNyX1lZw4Hiu6imKXAed6HtLDRd1I1XZII7krNsQqdlu7FWQ=="
}
The requested session ID was found, and the session details returned.
400 Expired
{
status: 400,
message: 'Session has expired',
}
The requested session ID is expired.
404 Session Doesn't Exist
{
status: 404,
message: "Session with this sessionId doesn't exist",
},
The requested session ID does not exist.