onStatusChange (Response callback)
for CDN version:
privo.lgs.onStatusChange(event => {})
for NPM version:
import { getInstance } from "privo-lgs-sdk";
getInstance().onStatusChange(event => {})
It returns:
interface LGSEvent {
status: LGSStatus;
consent_response?: ConsentResponseTO;
}
type LGSStatus = "ConsentCreated" | "Canceled";
type ConsentResponseTO = {
principal_access_token?: string | null | undefined;
url?: string | null | undefined;
consent_identifier: string;
};
Example of real data:
{
"status": "ConsentCreated",
"consent_response": {
"consent_identifier": "5e2712ca-555d-425f-9914-f7a6ec4eeb62",
"url": "https://consent-svc-int.privo.com/api/v1.0/tictacprivo/requests/5e2712ca-555d-425f-9914-f7a6ec4eeb62",
"principal_access_token": "eyJ0eXAiOiJKV1Qi.....WPRkZjcMFQ"
}
}
The method is invoked by the "Run" methods to handle status change results after "Run".
Parameters:
status - Current status of the consent request. Can be "ConsentCreated" or "Cancelled".
consent_identifier - identifier of created consent
url - url for created consent request
principal_access_token - principal access token