Table of Contents

Class WindowInterop

Namespace
Arc4u.Blazor
Assembly
Arc4u.OAuth2.Blazor.dll

Provides a mechanism to interact with an OAuth token window.

[Export(typeof(ITokenWindowInterop))]
[Shared]
public class WindowInterop : ITokenWindowInterop
Inheritance
WindowInterop
Implements
Inherited Members

Methods

OpenWindowAsync(IJSRuntime, ILocalStorageService, string, string)

Opens a new window asynchronously with the specified URL and features, using the provided JS runtime and local storage service. Also, it handles the local storage entries for "token" and "fetching" before opening the window. The method waits for the "fetching" entry to be set in local storage, signaling the completion of token fetching, before returning.

public Task OpenWindowAsync(IJSRuntime jsRuntime, ILocalStorageService localStorage, string url, string feature = "toolbar=no,scrollbars=yes,resizable=yes,top=500,left=500,width=450,height=500")

Parameters

jsRuntime IJSRuntime

The JS runtime to use for opening the window.

localStorage ILocalStorageService

The local storage service to use for storing and retrieving tokens.

url string

The URL to open in the new window.

feature string

The features of the new window. Defaults to "toolbar=no,scrollbars=yes,resizable=yes,top=500,left=500,width=450,height=500".

Returns

Task

A task representing the asynchronous operation.

Exceptions

InvalidOperationException

The popup could not be opened, typically because _content/Arc4u.OAuth2.Blazor/CreatePopupWindow.js is not referenced by the application.

TimeoutException

The login was not completed within 5 minutes, for example because the popup was closed.