
790yk (790yk) asked a question.
We're currently using the Okta hosted login widget, but are transitioning to hosting it ourselves. In the Okta hosted page we're currently doing this to dynamically retrieve the client id for the target application:
function getClientId() {
if (!OktaUtil) return undefined;
var requestContext = OktaUtil.getRequestContext();
if (requestContext && requestContext.target && requestContext.target.clientId) {
return requestContext.target.clientId;
}
}
Is there a way to access OktaUtil on self hosted page? Or a way different way to dynamically access the client id as the requests occur?

@790yk (790yk) Hi, You
To check self-hosted, you can refer the below article,
https://developer.okta.com/docs/guides/style-the-widget/style-self-hosted/
To check okta-hosted, you may refer the below article,
https://developer.okta.com/docs/guides/style-the-widget/style-okta-hosted/
In the doc of customization example, there is a way to render page with OktaUtil object.
https://developer.okta.com/docs/guides/style-the-widget/customization-examples/#per-application-customization
"When the page renders, an object called OktaUtil exists on the page. By calling the OktaUtil.getRequestContext() method, scripts on the page can get details about the current request. "
If this does not satisfy your request in self hosted, you can double check the sign in widget sdk on GH https://github.com/okta/okta-signin-widget#using-the-npm-module
and post the question under issues tab when necessary.
Thanks