AboutSupportDeveloper GuideVersion 41.132.100.57

Generated when a window within this application requires credentials from the user.

When a proxy exists, our default behavior shows an auth dialog, and asks users to enter their username and password. If you would like to change the default behavior, you can use the 'window-auth-requested' event to override it.

Show customized auth dialog instead of default auth dialog:


// Sample code to create a login window. Users can create their own login pages
async function createAuthUI(identity, loginPageUrl, authInfo) {
const winName = 'my-auth-win-' + Date.now();
const uriUuid = encodeURIComponent(identity.uuid);
const uriName = encodeURIComponent(identity.name);

const url = `http://${authInfo.host}:${authInfo.port}`;
// login page should handle these query params
loginPageUrl = `${loginPageUrl}?uuid=${uriUuid}&name=${uriName}&url=${url}`;
await fin.Window.create({
url: loginPageUrl,
uuid: identity.uuid,
name: winName,
alwaysOnTop: true,
autoShow: true,
defaultCentered: true,
defaultHeight: 271,
defaultTop: true,
defaultWidth: 362,
frame: false,
resizable: false
});
}

const app = fin.Application.getCurrentSync();
app.on('window-auth-requested', (event) => {
if (event.authInfo.isProxy) {
const identity = { uuid: event.uuid, name: event.name};
createAuthUI(identity, 'userLoginPageUrl', event.authInfo);
}

});

Don't show any auth dialog:

const app = fin.Application.getCurrentSync();
app.on('window-auth-requested', event => {
if (event.authInfo.isProxy) {
console.log('no auth dialog');
}
});

User defined function. For example, showing a single dialog, alerting a support team and so on:

const app = fin.Application.getCurrentSync();
app.on('window-auth-requested', event => {
if (event.authInfo.isProxy) {
// user defined function
alert('Do whatever you like');
}
});
interface AuthRequestedEvent {
    authInfo: {
        host: string;
        isProxy: boolean;
        port: number;
        realm: string;
        scheme: string;
    };
    name: string;
    topic: "window";
    type: "auth-requested";
    uuid: string;
}

Properties

authInfo: {
    host: string;
    isProxy: boolean;
    port: number;
    realm: string;
    scheme: string;
}
name: string
topic: "window"

The "kebab-case" classname of the emitter that raised the event.

OpenFin.Frame is represented as iframe.

type: "auth-requested"

The type of event that was raised. Equal to the typename of the event payload in "kebab case".

Guaranteed to be unique within each topic, but can be repeated between topics (e.g. WebContentsEvents.CrashedEvent and ApplicationEvents.CrashedEvent).

uuid: string