Skip to content

Instantly share code, notes, and snippets.

@OnurGumus
Last active March 27, 2023 09:17
Show Gist options
  • Save OnurGumus/e4b72133293e9675bfc3d8b0b1465742 to your computer and use it in GitHub Desktop.
Save OnurGumus/e4b72133293e9675bfc3d8b0b1465742 to your computer and use it in GitHub Desktop.
MSAL wrapper Fable
module Example
open Fable.Core
open Fable.Core.JsInterop
open Msal
open Configuration
open Account
open System.Collections.Generic
module private Internal =
[<Import("*", from = "msal")>]
let userAgent: UserAgentApplication.IExports = jsNative
let private msalConfig () : Configuration =
let authSettings: AuthOptions =
!!{| clientId = "your-client-id"
navigateToLoginRequestUrl = Some true
validateAuthority = true
authority = Some "Could be https://login.microsoftonline.com/common/ or another" |}
//See: https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-client-application-configuration
let cacheSettings: CacheOptions =
!!{| cacheLocation = CacheLocation.SessionStorage
storeAuthStateInCookie = false |}
let config: Configuration =
!!{| auth = authSettings
cache = cacheSettings |}
config
let getAuthenticationParameters (account: Account option) : AuthenticationParameters.AuthenticationParameters =
!!{| scopes = [| "your scopes here" |] :> IList<_> |> Some |}
//See: https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-v1-app-scopes
let msal = userAgent.UserAgentApplication.Create(msalConfig ())
let mutable accessToken = None
let tokenRecievedCallback (authErr: UserAgentApplication.AuthError) (response: AuthResponse.AuthResponse) =
msal.acquireTokenSilent (getAuthenticationParameters (None))
|> Promise.iter
(fun x -> accessToken <- Some x.accessToken)
msal.handleRedirectCallback tokenRecievedCallback
open Internal
let login () =
msal.loginRedirect (getAuthenticationParameters (None))
let getToken () = accessToken
let logout () = msal.logout ()
// ts2fable 0.8.0-build.718
module rec Msal
#nowarn "3390" // disable warnings for invalid XML comments
open System
open Fable.Core
open Fable.Core.JS
open Browser.Types
type Array<'T> = System.Collections.Generic.IList<'T>
type Error = System.Exception
module Account =
type ClientInfo = ClientInfo.ClientInfo
type IdToken = IdToken.IdToken
type StringDict = MsalTypes.StringDict
type [<AllowNullLiteral>] IExports =
/// accountIdentifier combination of idToken.uid and idToken.utid
/// homeAccountIdentifier combination of clientInfo.uid and clientInfo.utid
/// userName idToken.preferred_username
/// name idToken.name
/// idToken idToken
/// sid idToken.sid - session identifier
/// environment idtoken.issuer (the authority that issues the token)
abstract Account: AccountStatic
/// accountIdentifier combination of idToken.uid and idToken.utid
/// homeAccountIdentifier combination of clientInfo.uid and clientInfo.utid
/// userName idToken.preferred_username
/// name idToken.name
/// idToken idToken
/// sid idToken.sid - session identifier
/// environment idtoken.issuer (the authority that issues the token)
type [<AllowNullLiteral>] Account =
abstract accountIdentifier: string with get, set
abstract homeAccountIdentifier: string with get, set
abstract userName: string with get, set
abstract name: string with get, set
abstract idToken: StringDict with get, set
abstract idTokenClaims: StringDict with get, set
abstract sid: string with get, set
abstract environment: string with get, set
/// accountIdentifier combination of idToken.uid and idToken.utid
/// homeAccountIdentifier combination of clientInfo.uid and clientInfo.utid
/// userName idToken.preferred_username
/// name idToken.name
/// idToken idToken
/// sid idToken.sid - session identifier
/// environment idtoken.issuer (the authority that issues the token)
type [<AllowNullLiteral>] AccountStatic =
/// <summary>Creates an Account Object</summary>
/// <param name="homeAccountIdentifier" />
/// <param name="userName" />
/// <param name="name" />
/// <param name="idToken" />
/// <param name="sid" />
/// <param name="environment" />
[<EmitConstructor>] abstract Create: accountIdentifier: string * homeAccountIdentifier: string * userName: string * name: string * idTokenClaims: StringDict * sid: string * environment: string -> Account
/// <param name="idToken" />
/// <param name="clientInfo" />
abstract createAccount: idToken: IdToken * clientInfo: ClientInfo -> Account
/// <summary>Utils function to compare two Account objects - used to check if the same user account is logged in</summary>
/// <param name="a1">Account object</param>
/// <param name="a2">Account object</param>
abstract compareAccounts: a1: Account * a2: Account -> bool
module AuthResponse =
type Account = Account.Account
type IdToken = IdToken.IdToken
type StringDict = MsalTypes.StringDict
type [<AllowNullLiteral>] IExports =
abstract buildResponseStateOnly: state: string -> AuthResponse
type [<AllowNullLiteral>] AuthResponse =
abstract uniqueId: string with get, set
abstract tenantId: string with get, set
abstract tokenType: string with get, set
abstract idToken: IdToken with get, set
abstract idTokenClaims: StringDict with get, set
abstract accessToken: string with get, set
abstract scopes: Array<string> with get, set
abstract expiresOn: DateTime with get, set
abstract account: Account with get, set
abstract accountState: string with get, set
abstract fromCache: bool with get, set
module AuthenticationParameters =
type Account = Account.Account
type StringDict = MsalTypes.StringDict
type [<AllowNullLiteral>] IExports =
abstract validateClaimsRequest: request: AuthenticationParameters -> unit
type [<AllowNullLiteral>] AuthenticationParameters =
abstract scopes: Array<string> option with get, set
abstract extraScopesToConsent: Array<string> option with get, set
abstract prompt: string option with get, set
abstract extraQueryParameters: StringDict option with get, set
abstract claimsRequest: string option with get, set
abstract authority: string option with get, set
abstract state: string option with get, set
abstract correlationId: string option with get, set
abstract account: Account option with get, set
abstract sid: string option with get, set
abstract loginHint: string option with get, set
abstract forceRefresh: bool option with get, set
abstract redirectUri: string option with get, set
abstract redirectStartPage: string option with get, set
abstract authorityMetadata: string option with get, set
abstract onRedirectNavigate: (string -> U2<unit, bool>) option with get, set
module ClientInfo =
type IdToken = IdToken.IdToken
type [<AllowNullLiteral>] IExports =
abstract ClientInfo: ClientInfoStatic
type [<AllowNullLiteral>] ClientInfo =
abstract uid: string with get, set
abstract utid: string with get, set
abstract encodeClientInfo: unit -> string
type [<AllowNullLiteral>] ClientInfoStatic =
abstract createClientInfoFromIdToken: idToken: IdToken * authority: string -> ClientInfo
[<EmitConstructor>] abstract Create: rawClientInfo: string * authority: string -> ClientInfo
abstract stripPolicyFromUid: uid: string * authority: string -> string
module Configuration =
type Logger = Logger.Logger
type TelemetryEmitter = __telemetry_TelemetryTypes.TelemetryEmitter
type [<AllowNullLiteral>] IExports =
/// <summary>MSAL function that sets the default options when not explicitly configured from app developer</summary>
/// <param name="TAuthOptions" />
/// <param name="TCacheOptions" />
/// <param name="TSystemOptions" />
/// <param name="TFrameworkOptions" />
/// <param name="TAuthorityDataOptions" />
/// <returns>TConfiguration object</returns>
abstract buildConfiguration: p0: Configuration -> Configuration
/// Cache location options supported by MSAL are:
/// - local storage: MSAL uses browsers local storage to store its cache
/// - session storage: MSAL uses the browsers session storage to store its cache
type [<StringEnum>] [<RequireQualifiedAccess>] CacheLocation =
| LocalStorage
| SessionStorage
type [<AllowNullLiteral>] AuthOptions =
abstract clientId: string with get, set
abstract authority: string option with get, set
abstract validateAuthority: bool option with get, set
abstract authorityMetadata: string option with get, set
abstract knownAuthorities: Array<string> option with get, set
abstract redirectUri: U2<string, (unit -> string)> option with get, set
abstract postLogoutRedirectUri: U2<string, (unit -> string)> option with get, set
abstract navigateToLoginRequestUrl: bool option with get, set
/// Use this to configure the below cache configuration options:
///
/// - cacheLocation - Used to specify the cacheLocation user wants to set. Valid values are "localStorage" and "sessionStorage"
/// - storeAuthStateInCookie - If set, MSAL store's the auth request state required for validation of the auth flows in the browser cookies. By default this flag is set to false.
type [<AllowNullLiteral>] CacheOptions =
abstract cacheLocation: CacheLocation with get, set
abstract storeAuthStateInCookie: bool with get, set
/// Telemetry Config Options
/// - applicationName - Name of the consuming apps application
/// - applicationVersion - Verison of the consuming application
/// - telemetryEmitter - Function where telemetry events are flushed to
type [<AllowNullLiteral>] TelemetryOptions =
abstract applicationName: string with get, set
abstract applicationVersion: string with get, set
abstract telemetryEmitter: TelemetryEmitter with get, set
/// Library Specific Options
///
/// - logger - Used to initialize the Logger object; TODO: Expand on logger details or link to the documentation on logger
/// - loadFrameTimeout - maximum time the library should wait for a frame to load
/// - tokenRenewalOffsetSeconds - sets the window of offset needed to renew the token before expiry
/// - navigateFrameWait - sets the wait time for hidden iFrame navigation
type [<AllowNullLiteral>] SystemOptions =
abstract logger: Logger option with get, set
abstract loadFrameTimeout: float option with get, set
abstract tokenRenewalOffsetSeconds: float option with get, set
abstract navigateFrameWait: float option with get, set
abstract telemetry: TelemetryOptions option with get, set
/// <summary>
/// App/Framework specific environment support
///
/// - isAngular - flag set to determine if it is Angular Framework. MSAL uses this to broadcast tokens. More to come here: detangle this dependency from core.
/// - unprotectedResources - Array of URI's which are unprotected resources. MSAL will not attach a token to outgoing requests that have these URI. Defaults to 'null'.
/// - protectedResourceMap - This is mapping of resources to scopes used by MSAL for automatically attaching access tokens in web API calls.A single access token is obtained for the resource. So you can map a specific resource path as follows: {"<see href="https://graph.microsoft.com/v1.0/me"," /> ["user.read"]}, or the app URL of the resource as: {"<see href="https://graph.microsoft.com/"," /> ["user.read", "mail.send"]}. This is required for CORS calls.
/// </summary>
type [<AllowNullLiteral>] FrameworkOptions =
abstract isAngular: bool option with get, set
abstract unprotectedResources: Array<string> option with get, set
abstract protectedResourceMap: Map<string, Array<string>> option with get, set
/// Use the configuration object to configure MSAL and initialize the UserAgentApplication.
///
/// This object allows you to configure important elements of MSAL functionality:
/// - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform
/// - cache: this is where you configure cache location and whether to store cache in cookies
/// - system: this is where you can configure the logger, frame timeout etc.
/// - framework: this is where you can configure the running mode of angular. More to come here soon.
type [<AllowNullLiteral>] Configuration =
abstract auth: AuthOptions with get, set
abstract cache: CacheOptions option with get, set
abstract system: SystemOptions option with get, set
abstract framework: FrameworkOptions option with get, set
module IUri =
type [<AllowNullLiteral>] IUri =
abstract Protocol: string with get, set
abstract HostNameAndPort: string with get, set
abstract AbsolutePath: string with get, set
abstract Search: string with get, set
abstract Hash: string with get, set
abstract PathSegments: ResizeArray<string> with get, set
module IdToken =
type StringDict = MsalTypes.StringDict
type [<AllowNullLiteral>] IExports =
abstract IdToken: IdTokenStatic
type [<AllowNullLiteral>] IdToken =
abstract issuer: string with get, set
abstract objectId: string with get, set
abstract subject: string with get, set
abstract tenantId: string with get, set
abstract version: string with get, set
abstract preferredName: string with get, set
abstract name: string with get, set
abstract homeObjectId: string with get, set
abstract nonce: string with get, set
abstract expiration: string with get, set
abstract rawIdToken: string with get, set
abstract claims: StringDict with get, set
abstract sid: string with get, set
abstract cloudInstance: string with get, set
type [<AllowNullLiteral>] IdTokenStatic =
[<EmitConstructor>] abstract Create: rawIdToken: string -> IdToken
module Logger =
type [<AllowNullLiteral>] IExports =
abstract Logger: LoggerStatic
type [<AllowNullLiteral>] ILoggerCallback =
[<Emit("$0($1...)")>] abstract Invoke: level: LogLevel * message: string * containsPii: bool -> unit
type [<RequireQualifiedAccess>] LogLevel =
| Error = 0
| Warning = 1
| Info = 2
| Verbose = 3
type [<AllowNullLiteral>] Logger =
abstract executeCallback: level: LogLevel * message: string * containsPii: bool -> unit
abstract error: message: string -> unit
abstract errorPii: message: string -> unit
abstract warning: message: string -> unit
abstract warningPii: message: string -> unit
abstract info: message: string -> unit
abstract infoPii: message: string -> unit
abstract verbose: message: string -> unit
abstract verbosePii: message: string -> unit
abstract isPiiLoggingEnabled: unit -> bool
type [<AllowNullLiteral>] LoggerStatic =
[<EmitConstructor>] abstract Create: localCallback: ILoggerCallback * ?options: {| correlationId: string option; level: LogLevel option; piiLoggingEnabled: bool option |} -> Logger
module MsalTypes =
/// Key-Value type to support queryParams, extraQueryParams and claims
type [<AllowNullLiteral>] StringDict =
[<EmitIndexer>] abstract Item: key: string -> string with get, set
module ScopeSet =
type [<AllowNullLiteral>] IExports =
abstract ScopeSet: ScopeSetStatic
type [<AllowNullLiteral>] ScopeSet =
interface end
type [<AllowNullLiteral>] ScopeSetStatic =
[<EmitConstructor>] abstract Create: unit -> ScopeSet
/// <summary>Check if there are dup scopes in a given request</summary>
/// <param name="cachedScopes" />
/// <param name="scopes" />
abstract isIntersectingScopes: cachedScopes: Array<string> * scopes: Array<string> -> bool
/// <summary>Check if a given scope is present in the request</summary>
/// <param name="cachedScopes" />
/// <param name="scopes" />
abstract containsScope: cachedScopes: Array<string> * scopes: Array<string> -> bool
/// <summary>Trims and converts string to lower case</summary>
/// <param name="scopes" />
abstract trimAndConvertToLowerCase: scope: string -> string
/// <summary>Performs trimAndConvertToLowerCase on string array</summary>
/// <param name="scopes" />
abstract trimAndConvertArrayToLowerCase: scopes: Array<string> -> Array<string>
/// <summary>Trims each scope in scopes array</summary>
/// <param name="scopes" />
abstract trimScopes: scopes: Array<string> -> Array<string>
/// <summary>Remove one element from a scope array</summary>
/// <param name="scopes" />
/// <param name="scope" />
abstract removeElement: scopes: Array<string> * scope: string -> Array<string>
/// <summary>Parse the scopes into a formatted scopeList</summary>
/// <param name="scopes" />
abstract parseScope: scopes: Array<string> -> string
/// <param name="scopes">Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.</param>
/// <param name="scopesRequired">Boolean indicating whether the scopes array is required or not</param>
abstract validateInputScope: scopes: Array<string> * scopesRequired: bool -> unit
/// <param name="state" />
/// <returns>scope.</returns>
abstract getScopeFromState: state: string -> string
/// <param name="" />
abstract appendScopes: reqScopes: Array<string> * reqExtraScopesToConsent: Array<string> -> Array<string>
abstract onlyContainsOidcScopes: scopes: Array<string> -> bool
abstract containsAnyOidcScopes: scopes: Array<string> -> bool
abstract onlyContainsClientId: scopes: Array<String> * clientId: string -> bool
abstract appendDefaultScopes: scopes: Array<string> -> Array<string>
abstract removeDefaultScopes: scopes: Array<string> -> Array<string>
/// <param name="scopes">Array&lt;string&gt;: Pre-normalized scopes array</param>
/// <param name="clientId">string: The application's clientId that is searched for in the scopes array</param>
abstract translateClientIdIfSingleScope: scopes: Array<string> * clientId: string -> Array<string>
module ServerRequestParameters =
type Authority = __authority_Authority.Authority
type AuthenticationParameters = AuthenticationParameters.AuthenticationParameters
type StringDict = MsalTypes.StringDict
type Account = Account.Account
type [<AllowNullLiteral>] IExports =
/// <summary>
/// Nonce: OIDC Nonce definition: <see href="https://openid.net/specs/openid-connect-core-1_0.html#IDToken" />
/// State: OAuth Spec: <see href="https://tools.ietf.org/html/rfc6749#section-10.12" />
/// </summary>
abstract ServerRequestParameters: ServerRequestParametersStatic
/// <summary>
/// Nonce: OIDC Nonce definition: <see href="https://openid.net/specs/openid-connect-core-1_0.html#IDToken" />
/// State: OAuth Spec: <see href="https://tools.ietf.org/html/rfc6749#section-10.12" />
/// </summary>
type [<AllowNullLiteral>] ServerRequestParameters =
abstract authorityInstance: Authority with get, set
abstract clientId: string with get, set
abstract scopes: Array<string> with get, set
abstract nonce: string with get, set
abstract state: string with get, set
abstract xClientVer: string with get, set
abstract xClientSku: string with get, set
abstract correlationId: string with get, set
abstract responseType: string with get, set
abstract redirectUri: string with get, set
abstract promptValue: string with get, set
abstract claimsValue: string with get, set
abstract queryParameters: string with get, set
abstract extraQueryParameters: string with get, set
abstract authority: string
/// <param name="request" />
/// <param name="serverAuthenticationRequest" />
abstract populateQueryParams: account: Account * request: AuthenticationParameters option * ?adalIdTokenObject: obj * ?silentCall: bool -> unit
/// <summary>
/// Nonce: OIDC Nonce definition: <see href="https://openid.net/specs/openid-connect-core-1_0.html#IDToken" />
/// State: OAuth Spec: <see href="https://tools.ietf.org/html/rfc6749#section-10.12" />
/// </summary>
type [<AllowNullLiteral>] ServerRequestParametersStatic =
/// <summary>Constructor</summary>
/// <param name="authority" />
/// <param name="clientId" />
/// <param name="scope" />
/// <param name="responseType" />
/// <param name="redirectUri" />
/// <param name="state" />
[<EmitConstructor>] abstract Create: authority: Authority * clientId: string * responseType: string * redirectUri: string * scopes: Array<string> * state: string * correlationId: string -> ServerRequestParameters
/// <summary>Utility to generate a QueryParameterString from a Key-Value mapping of extraQueryParameters passed</summary>
/// <param name="extraQueryParameters" />
abstract generateQueryParametersString: ?queryParameters: StringDict * ?silentCall: bool -> string option
/// <summary>Check to see if there are SSO params set in the Request</summary>
/// <param name="request" />
abstract isSSOParam: request: AuthenticationParameters -> bool
/// <summary>Returns the correct response_type string attribute for an acquireToken request configuration</summary>
/// <param name="accountsMatch">boolean: Determines whether the account in the request matches the cached account</param>
/// <param name="scopes">Array&lt;string&gt;: AuthenticationRequest scopes configuration</param>
/// <param name="loginScopesOnly">boolean: True if the scopes array ONLY contains the clientId or any combination of OIDC scopes, without resource scopes</param>
abstract determineResponseType: accountsMatch: bool * scopes: Array<string> -> string
module UserAgentApplication =
type Authority = __authority_Authority.Authority
type Logger = Logger.Logger
type AuthCache = __cache_AuthCache.AuthCache
type Account = Account.Account
type Configuration = Configuration.Configuration
type AuthenticationParameters = AuthenticationParameters.AuthenticationParameters
type AuthError = __error_AuthError.AuthError
type AuthResponse = AuthResponse.AuthResponse
type [<AllowNullLiteral>] IExports =
/// UserAgentApplication class
///
/// Object Instance that the developer can use to make loginXX OR acquireTokenXX functions
abstract UserAgentApplication: UserAgentApplicationStatic
type [<AllowNullLiteral>] Window =
abstract msal: Object with get, set
abstract CustomEvent: CustomEvent with get, set
abstract Event: Event with get, set
abstract activeRenewals: WindowActiveRenewals with get, set
abstract renewStates: Array<string> with get, set
abstract callbackMappedToRenewStates: WindowActiveRenewals with get, set
abstract promiseMappedToRenewStates: WindowActiveRenewals with get, set
abstract openedWindows: Array<Window> with get, set
abstract requestType: string with get, set
type [<AllowNullLiteral>] CacheResult =
abstract errorDesc: string with get, set
abstract token: string with get, set
abstract error: string with get, set
type [<AllowNullLiteral>] ResponseStateInfo =
abstract state: string with get, set
abstract timestamp: float with get, set
abstract method: string with get, set
abstract stateMatch: bool with get, set
abstract requestType: string with get, set
/// <summary>
/// A type alias for an authResponseCallback function.
/// <see cref="(authResponseCallback:type)" />
/// </summary>
/// <param name="authErr">error created for failure cases</param>
/// <param name="response">response containing token strings in success cases, or just state value in error cases</param>
type [<AllowNullLiteral>] authResponseCallback =
/// <summary>
/// A type alias for an authResponseCallback function.
/// <see cref="(authResponseCallback:type)" />
/// </summary>
/// <param name="authErr">error created for failure cases</param>
/// <param name="response">response containing token strings in success cases, or just state value in error cases</param>
[<Emit("$0($1...)")>] abstract Invoke: authErr: AuthError * ?response: AuthResponse -> unit
/// <summary>
/// A type alias for a tokenReceivedCallback function.
/// <see cref="(tokenReceivedCallback:type)" />
/// </summary>
/// <returns>
/// response of type <see cref="(AuthResponse:type)" />
/// The function that will get the call back once this API is completed (either successfully or with a failure).
/// </returns>
type [<AllowNullLiteral>] tokenReceivedCallback =
/// <summary>
/// A type alias for a tokenReceivedCallback function.
/// <see cref="(tokenReceivedCallback:type)" />
/// </summary>
/// <returns>
/// response of type <see cref="(AuthResponse:type)" />
/// The function that will get the call back once this API is completed (either successfully or with a failure).
/// </returns>
[<Emit("$0($1...)")>] abstract Invoke: response: AuthResponse -> unit
/// <summary>
/// A type alias for a errorReceivedCallback function.
/// <see cref="(errorReceivedCallback:type)" />
/// </summary>
/// <returns>response of type <see cref="(AuthError:class)" /></returns>
/// <returns>account state</returns>
type [<AllowNullLiteral>] errorReceivedCallback =
/// <summary>
/// A type alias for a errorReceivedCallback function.
/// <see cref="(errorReceivedCallback:type)" />
/// </summary>
/// <returns>response of type <see cref="(AuthError:class)" /></returns>
/// <returns>account state</returns>
[<Emit("$0($1...)")>] abstract Invoke: authErr: AuthError * accountState: string -> unit
/// UserAgentApplication class
///
/// Object Instance that the developer can use to make loginXX OR acquireTokenXX functions
type [<AllowNullLiteral>] UserAgentApplication =
abstract cacheStorage: AuthCache with get, set
abstract authorityInstance: Authority with get, set
/// <summary>
/// setter for the authority URL
/// Method to manage the authority URL.
/// </summary>
/// <returns>authority</returns>
abstract authority: string with get, set
/// <summary>Get the current authority instance from the MSAL configuration object</summary>
/// <returns />
abstract getAuthorityInstance: unit -> Authority
/// <param name="" />
/// <param name="" />
// abstract handleRedirectCallback: tokenReceivedCallback: tokenReceivedCallback * errorReceivedCallback: errorReceivedCallback -> unit
// abstract handleRedirectCallback: authCallback: authResponseCallback -> unit
abstract handleRedirectCallback: (AuthError -> AuthResponse -> unit) -> unit
/// <summary>Public API to verify if the URL contains the hash with known properties</summary>
/// <param name="hash" />
abstract urlContainsHash: hash: string -> bool
/// <summary>Use when initiating the login process by redirecting the user's browser to the authorization endpoint.</summary>
/// <param name="" />
abstract loginRedirect: ?userRequest: AuthenticationParameters -> unit
/// <summary>Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint.</summary>
/// <param name="" />
abstract acquireTokenRedirect: userRequest: AuthenticationParameters -> unit
/// <summary>Use when initiating the login process via opening a popup window in the user's browser</summary>
/// <param name="" />
/// <returns>- a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the <see cref="AuthResponse" /> object</returns>
abstract loginPopup: ?userRequest: AuthenticationParameters -> Promise<AuthResponse>
/// <summary>Use when you want to obtain an access_token for your API via opening a popup window in the user's browser</summary>
/// <param name="" />
/// <returns>- a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the <see cref="AuthResponse" /> object</returns>
abstract acquireTokenPopup: userRequest: AuthenticationParameters -> Promise<AuthResponse>
/// <summary>API interfacing idToken request when applications already have a session/hint acquired by authorization client applications</summary>
/// <param name="request" />
abstract ssoSilent: request: AuthenticationParameters -> Promise<AuthResponse>
/// <summary>
/// Use this function to obtain a token before every call to the API / resource provider
///
/// MSAL return's a cached token when available
/// Or it send's a request to the STS to obtain a new token using a hidden iframe.
/// </summary>
/// <param name="" />
/// <returns>- a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the <see cref="AuthResponse" /> object</returns>
abstract acquireTokenSilent: userRequest: AuthenticationParameters -> Promise<AuthResponse>
/// <summary>
/// Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
/// Default behaviour is to redirect the user to <c>window.location.href</c>.
/// </summary>
abstract logout: ?correlationId: string -> unit
abstract clearCache: unit -> unit
/// <param name="accessToken" />
abstract clearCacheForScope: accessToken: string -> unit
/// <param name="hash">Hash passed from redirect page.</param>
/// <returns>- true if response contains id_token, access_token or error, false otherwise.</returns>
abstract isCallback: hash: string -> bool
/// <param name="hash">Hash passed from redirect page</param>
/// <returns>an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.</returns>
abstract getResponseState: hash: string -> ResponseStateInfo
abstract saveTokenFromHash: hash: string * stateInfo: ResponseStateInfo -> AuthResponse
/// <summary>
/// Returns the signed in account
/// (the account object is created at the time of successful login)
/// or null when no state is found
/// </summary>
/// <returns />
abstract getAccount: unit -> Account
/// <returns>scope.</returns>
abstract getAccountState: state: string -> string
/// <summary>Use to get a list of unique accounts in MSAL cache based on homeAccountIdentifier.</summary>
/// <param name="" />
abstract getAllAccounts: unit -> Array<Account>
/// <param name="scopes" />
/// <param name="" />
/// <param name="state" />
/// <returns />
abstract getCachedTokenInternal: scopes: Array<string> * account: Account * state: string * ?correlationId: string -> AuthResponse
/// <param name="endpoint" />
abstract getScopesForEndpoint: endpoint: string -> Array<string>
/// <summary>Return boolean flag to developer to help inform if login is in progress</summary>
/// <returns>true/false</returns>
abstract getLoginInProgress: unit -> bool
/// <param name="loginInProgress" />
abstract setInteractionInProgress: inProgress: bool -> unit
/// <param name="loginInProgress" />
abstract setloginInProgress: loginInProgress: bool -> unit
abstract getAcquireTokenInProgress: unit -> bool
/// <param name="acquireTokenInProgress" />
abstract setAcquireTokenInProgress: acquireTokenInProgress: bool -> unit
abstract getLogger: unit -> Logger
/// <summary>Sets the logger callback.</summary>
/// <param name="logger">Logger callback</param>
abstract setLogger: logger: Logger -> unit
/// <summary>
/// Use to get the redirect uri configured in MSAL or null.
/// Evaluates redirectUri if its a function, otherwise simply returns its value.
/// </summary>
/// <returns>redirect URL</returns>
abstract getRedirectUri: ?reqRedirectUri: string -> string
/// <summary>
/// Use to get the post logout redirect uri configured in MSAL or null.
/// Evaluates postLogoutredirectUri if its a function, otherwise simply returns its value.
/// </summary>
/// <returns>post logout redirect URL</returns>
abstract getPostLogoutRedirectUri: unit -> string
/// <summary>Use to get the current <see cref="Configuration" /> object in MSAL</summary>
/// <returns />
abstract getCurrentConfiguration: unit -> Configuration
/// UserAgentApplication class
///
/// Object Instance that the developer can use to make loginXX OR acquireTokenXX functions
type [<AllowNullLiteral>] UserAgentApplicationStatic =
/// <param name="" />
[<EmitConstructor>] abstract Create: configuration: Configuration -> UserAgentApplication
type [<AllowNullLiteral>] WindowActiveRenewals =
interface end
module XHRClient =
type [<AllowNullLiteral>] IExports =
/// <summary>
/// XHR client for JSON endpoints
/// <see href="https://www.npmjs.com/package/async-promise" />
/// </summary>
abstract XhrClient: XhrClientStatic
/// <summary>
/// XHR client for JSON endpoints
/// <see href="https://www.npmjs.com/package/async-promise" />
/// </summary>
type [<AllowNullLiteral>] XhrClient =
abstract sendRequestAsync: url: string * method: string * ?enableCaching: bool -> Promise<XhrResponse>
abstract handleError: responseText: string -> string
/// <summary>
/// XHR client for JSON endpoints
/// <see href="https://www.npmjs.com/package/async-promise" />
/// </summary>
type [<AllowNullLiteral>] XhrClientStatic =
[<EmitConstructor>] abstract Create: unit -> XhrClient
type [<AllowNullLiteral>] XhrResponse =
abstract body: obj with get, set
abstract statusCode: float with get, set
module PackageMetadata =
type [<AllowNullLiteral>] IExports =
abstract name: obj
abstract version: obj
module __authority_Authority =
type IUri = IUri.IUri
type ITenantDiscoveryResponse = __authority_ITenantDiscoveryResponse.ITenantDiscoveryResponse
type TelemetryManager = __telemetry_TelemetryManager.TelemetryManager
type [<AllowNullLiteral>] IExports =
abstract Authority: AuthorityStatic
type [<RequireQualifiedAccess>] AuthorityType =
| Default = 0
| Adfs = 1
type [<AllowNullLiteral>] Authority =
abstract AuthorityType: AuthorityType
abstract IsValidationEnabled: bool with get, set
abstract Tenant: string
abstract AuthorizationEndpoint: string
abstract EndSessionEndpoint: string
abstract SelfSignedJwtAudience: string
/// A URL that is the authority set by the developer
abstract CanonicalAuthority: string with get, set
abstract CanonicalAuthorityUrlComponents: IUri
abstract DefaultOpenIdConfigurationEndpoint: string
/// Returns a promise.
/// Checks to see if the authority is in the cache
/// Discover endpoints via openid-configuration
/// If successful, caches the endpoint for later use in OIDC
abstract resolveEndpointsAsync: telemetryManager: TelemetryManager * correlationId: string -> Promise<ITenantDiscoveryResponse>
/// Checks if there is a cached tenant discovery response with required fields.
abstract hasCachedMetadata: unit -> bool
/// Returns a promise which resolves to the OIDC endpoint
/// Only responds with the endpoint
abstract GetOpenIdConfigurationEndpoint: unit -> string
type [<AllowNullLiteral>] AuthorityStatic =
[<EmitConstructor>] abstract Create: authority: string * validateAuthority: bool * ?authorityMetadata: ITenantDiscoveryResponse -> Authority
abstract isAdfs: authorityUrl: string -> bool
module __authority_AuthorityFactory =
type Authority = __authority_Authority.Authority
type TelemetryManager = __telemetry_TelemetryManager.TelemetryManager
type ITenantDiscoveryResponse = __authority_ITenantDiscoveryResponse.ITenantDiscoveryResponse
type [<AllowNullLiteral>] IExports =
abstract AuthorityFactory: AuthorityFactoryStatic
type [<AllowNullLiteral>] AuthorityFactory =
interface end
type [<AllowNullLiteral>] AuthorityFactoryStatic =
[<EmitConstructor>] abstract Create: unit -> AuthorityFactory
abstract saveMetadataFromNetwork: authorityInstance: Authority * telemetryManager: TelemetryManager * correlationId: string -> Promise<ITenantDiscoveryResponse>
abstract getMetadata: authorityUrl: string -> ITenantDiscoveryResponse
abstract saveMetadataFromConfig: authorityUrl: string * authorityMetadataJson: string -> unit
/// Create an authority object of the correct type based on the url
/// Performs basic authority validation - checks to see if the authority is of a valid type (eg aad, b2c)
abstract CreateInstance: authorityUrl: string * validateAuthority: bool * ?authorityMetadata: string -> Authority
module __authority_IInstanceDiscoveryResponse =
type [<AllowNullLiteral>] IInstanceDiscoveryResponse =
abstract TenantDiscoveryEndpoint: string with get, set
module __authority_ITenantDiscoveryResponse =
type [<AllowNullLiteral>] ITenantDiscoveryResponse =
abstract AuthorizationEndpoint: string with get, set
abstract EndSessionEndpoint: string with get, set
abstract Issuer: string with get, set
/// Response type for openid-configuration endpoints
type [<AllowNullLiteral>] OpenIdConfiguration =
abstract authorization_endpoint: string with get, set
abstract end_session_endpoint: string with get, set
abstract issuer: string with get, set
module __authority_TrustedAuthority =
type TelemetryManager = __telemetry_TelemetryManager.TelemetryManager
type [<AllowNullLiteral>] IExports =
abstract TrustedAuthority: TrustedAuthorityStatic
type [<AllowNullLiteral>] TrustedAuthority =
interface end
type [<AllowNullLiteral>] TrustedAuthorityStatic =
[<EmitConstructor>] abstract Create: unit -> TrustedAuthority
/// <param name="validateAuthority" />
/// <param name="knownAuthorities" />
abstract setTrustedAuthoritiesFromConfig: validateAuthority: bool * knownAuthorities: Array<string> -> unit
/// <param name="telemetryManager" />
/// <param name="correlationId" />
abstract setTrustedAuthoritiesFromNetwork: authorityToVerify: string * telemetryManager: TelemetryManager * ?correlationId: string -> Promise<unit>
abstract getTrustedHostList: unit -> Array<string>
/// <summary>Checks to see if the host is in a list of trusted hosts</summary>
/// <param name="host" />
abstract IsInTrustedHostList: host: string -> bool
module __cache_AccessTokenCacheItem =
type AccessTokenKey = __cache_AccessTokenKey.AccessTokenKey
type AccessTokenValue = __cache_AccessTokenValue.AccessTokenValue
type [<AllowNullLiteral>] IExports =
abstract AccessTokenCacheItem: AccessTokenCacheItemStatic
type [<AllowNullLiteral>] AccessTokenCacheItem =
abstract key: AccessTokenKey with get, set
abstract value: AccessTokenValue with get, set
type [<AllowNullLiteral>] AccessTokenCacheItemStatic =
[<EmitConstructor>] abstract Create: key: AccessTokenKey * value: AccessTokenValue -> AccessTokenCacheItem
module __cache_AccessTokenKey =
type [<AllowNullLiteral>] IExports =
abstract AccessTokenKey: AccessTokenKeyStatic
type [<AllowNullLiteral>] AccessTokenKey =
abstract authority: string with get, set
abstract clientId: string with get, set
abstract scopes: string with get, set
abstract homeAccountIdentifier: string with get, set
type [<AllowNullLiteral>] AccessTokenKeyStatic =
[<EmitConstructor>] abstract Create: authority: string * clientId: string * scopes: string * uid: string * utid: string -> AccessTokenKey
module __cache_AccessTokenValue =
type [<AllowNullLiteral>] IExports =
abstract AccessTokenValue: AccessTokenValueStatic
type [<AllowNullLiteral>] AccessTokenValue =
abstract accessToken: string with get, set
abstract idToken: string with get, set
abstract expiresIn: string with get, set
abstract homeAccountIdentifier: string with get, set
type [<AllowNullLiteral>] AccessTokenValueStatic =
[<EmitConstructor>] abstract Create: accessToken: string * idToken: string * expiresIn: string * homeAccountIdentifier: string -> AccessTokenValue
module __cache_AuthCache =
type TemporaryCacheKeys = __utils_Constants.TemporaryCacheKeys
type AccessTokenCacheItem = __cache_AccessTokenCacheItem.AccessTokenCacheItem
type CacheLocation = Configuration.CacheLocation
type BrowserStorage = __cache_BrowserStorage.BrowserStorage
type [<AllowNullLiteral>] IExports =
abstract AuthCache: AuthCacheStatic
type [<AllowNullLiteral>] AuthCache =
inherit BrowserStorage
/// <summary>add value to storage</summary>
/// <param name="key" />
/// <param name="value" />
/// <param name="enableCookieStorage" />
abstract setItem: key: string * value: string * ?enableCookieStorage: bool -> unit
/// <summary>get one item by key from storage</summary>
/// <param name="key" />
/// <param name="enableCookieStorage" />
abstract getItem: key: string * ?enableCookieStorage: bool -> string
/// <summary>remove value from storage</summary>
/// <param name="key" />
abstract removeItem: key: string -> unit
/// <summary>Sets temporary cache value</summary>
/// <param name="key" />
/// <param name="value" />
/// <param name="enableCookieStorage" />
abstract setTemporaryItem: key: string * value: string * ?enableCookieStorage: bool -> unit
/// <summary>Gets temporary cache value</summary>
/// <param name="key" />
/// <param name="enableCookieStorage" />
abstract getTemporaryItem: key: string * ?enableCookieStorage: bool -> string
/// Reset the cache items
abstract resetCacheItems: unit -> unit
/// Reset all temporary cache items
abstract resetTempCacheItems: ?state: string -> unit
/// <summary>Set cookies for IE</summary>
/// <param name="cName" />
/// <param name="cValue" />
/// <param name="expires" />
abstract setItemCookie: cName: string * cValue: string * ?expires: float -> unit
/// Clear an item in the cookies by key
abstract clearItemCookie: cName: string -> unit
/// <summary>get one item by key from cookies</summary>
/// <param name="cName" />
abstract getItemCookie: cName: string -> string
/// <summary>Get all tokens of a certain type from the cache</summary>
/// <param name="clientId" />
/// <param name="homeAccountIdentifier" />
/// <param name="tokenType" />
abstract getAllTokensByType: clientId: string * homeAccountIdentifier: string * tokenType: string -> Array<AccessTokenCacheItem>
/// <summary>Get all access tokens in the cache</summary>
/// <param name="clientId" />
/// <param name="homeAccountIdentifier" />
abstract getAllAccessTokens: clientId: string * homeAccountIdentifier: string -> Array<AccessTokenCacheItem>
/// Get all id tokens in the cache in the form of AccessTokenCacheItem objects so they are
/// in a normalized format and can make use of the existing cached access token validation logic
abstract getAllIdTokens: clientId: string * homeAccountIdentifier: string -> Array<AccessTokenCacheItem>
/// <summary>Get all access and ID tokens in the cache</summary>
/// <param name="clientId" />
/// <param name="homeAccountIdentifier" />
abstract getAllTokens: clientId: string * homeAccountIdentifier: string -> Array<AccessTokenCacheItem>
/// <summary>Returns whether or not interaction is currently in progress. Optionally scope it to just this clientId</summary>
/// <param name="forThisClient" />
abstract isInteractionInProgress: matchClientId: bool -> bool
/// Returns the clientId of the interaction currently in progress
abstract getInteractionInProgress: unit -> string
/// <summary>Sets interaction in progress state</summary>
/// <param name="isInProgress" />
abstract setInteractionInProgress: newInProgressValue: bool -> unit
/// Clear all cookies
abstract clearMsalCookie: ?state: string -> unit
type [<AllowNullLiteral>] AuthCacheStatic =
[<EmitConstructor>] abstract Create: clientId: string * cacheLocation: CacheLocation * storeAuthStateInCookie: bool -> AuthCache
/// <summary>Create acquireTokenAccountKey to cache account object</summary>
/// <param name="accountId" />
/// <param name="state" />
abstract generateAcquireTokenAccountKey: accountId: string * state: string -> string
/// <summary>Create authorityKey to cache authority</summary>
/// <param name="state" />
abstract generateAuthorityKey: state: string -> string
/// <summary>Generates the cache key for temporary cache items, using request state</summary>
/// <param name="tempCacheKey">Cache key prefix</param>
/// <param name="state">Request state value</param>
abstract generateTemporaryCacheKey: tempCacheKey: TemporaryCacheKeys * state: string -> string
module __cache_BrowserStorage =
type CacheLocation = Configuration.CacheLocation
type [<AllowNullLiteral>] IExports =
abstract BrowserStorage: BrowserStorageStatic
type [<AllowNullLiteral>] BrowserStorage =
abstract cacheLocation: CacheLocation with get, set
/// <summary>add value to storage</summary>
/// <param name="key" />
/// <param name="value" />
/// <param name="enableCookieStorage" />
abstract setItem: key: string * value: string * ?enableCookieStorage: bool -> unit
/// <summary>get one item by key from storage</summary>
/// <param name="key" />
/// <param name="enableCookieStorage" />
abstract getItem: key: string * ?enableCookieStorage: bool -> string
/// <summary>remove value from storage</summary>
/// <param name="key" />
abstract removeItem: key: string -> unit
/// clear storage (remove all items from it)
abstract clear: unit -> unit
/// <summary>add value to cookies</summary>
/// <param name="cName" />
/// <param name="cValue" />
/// <param name="expires" />
abstract setItemCookie: cName: string * cValue: string * ?expires: float -> unit
/// <summary>get one item by key from cookies</summary>
/// <param name="cName" />
abstract getItemCookie: cName: string -> string
/// <summary>Clear an item in the cookies by key</summary>
/// <param name="cName" />
abstract clearItemCookie: cName: string -> unit
/// <summary>Get cookie expiration time</summary>
/// <param name="cookieLifeDays" />
abstract getCookieExpirationTime: cookieLifeDays: float -> string
type [<AllowNullLiteral>] BrowserStorageStatic =
[<EmitConstructor>] abstract Create: cacheLocation: CacheLocation -> BrowserStorage
module __error_AuthError =
type [<AllowNullLiteral>] IExports =
abstract AuthErrorMessage: {| unexpectedError: {| code: string; desc: string |}; noWindowObjectError: {| code: string; desc: string |} |}
/// General error class thrown by the MSAL.js library.
abstract AuthError: AuthErrorStatic
/// General error class thrown by the MSAL.js library.
type [<AllowNullLiteral>] AuthError =
abstract errorCode: string with get, set
abstract errorMessage: string with get, set
/// General error class thrown by the MSAL.js library.
type [<AllowNullLiteral>] AuthErrorStatic =
[<EmitConstructor>] abstract Create: errorCode: string * ?errorMessage: string -> AuthError
abstract createUnexpectedError: errDesc: string -> AuthError
abstract createNoWindowObjectError: errDesc: string -> AuthError
module __error_ClientAuthError =
type AuthError = __error_AuthError.AuthError
type IdToken = IdToken.IdToken
type [<AllowNullLiteral>] IExports =
abstract ClientAuthErrorMessage: IExportsClientAuthErrorMessage
/// Error thrown when there is an error in the client code running on the browser.
abstract ClientAuthError: ClientAuthErrorStatic
/// Error thrown when there is an error in the client code running on the browser.
type [<AllowNullLiteral>] ClientAuthError =
inherit AuthError
/// Error thrown when there is an error in the client code running on the browser.
type [<AllowNullLiteral>] ClientAuthErrorStatic =
[<EmitConstructor>] abstract Create: errorCode: string * ?errorMessage: string -> ClientAuthError
abstract createEndpointResolutionError: ?errDetail: string -> ClientAuthError
abstract createPopupWindowError: ?errDetail: string -> ClientAuthError
abstract createTokenRenewalTimeoutError: unit -> ClientAuthError
abstract createInvalidIdTokenError: idToken: IdToken -> ClientAuthError
abstract createInvalidStateError: invalidState: string * actualState: string -> ClientAuthError
abstract createNonceMismatchError: invalidNonce: string * actualNonce: string -> ClientAuthError
abstract createLoginInProgressError: unit -> ClientAuthError
abstract createAcquireTokenInProgressError: unit -> ClientAuthError
abstract createUserCancelledError: unit -> ClientAuthError
abstract createErrorInCallbackFunction: errorDesc: string -> ClientAuthError
abstract createUserLoginRequiredError: unit -> ClientAuthError
abstract createUserDoesNotExistError: unit -> ClientAuthError
abstract createClientInfoDecodingError: caughtError: string -> ClientAuthError
abstract createClientInfoNotPopulatedError: caughtError: string -> ClientAuthError
abstract createIdTokenNullOrEmptyError: invalidRawTokenString: string -> ClientAuthError
abstract createIdTokenParsingError: caughtParsingError: string -> ClientAuthError
abstract createTokenEncodingError: incorrectlyEncodedToken: string -> ClientAuthError
abstract createInvalidInteractionTypeError: unit -> ClientAuthError
abstract createCacheParseError: key: string -> ClientAuthError
abstract createBlockTokenRequestsInHiddenIframeError: unit -> ClientAuthError
type [<AllowNullLiteral>] IExportsClientAuthErrorMessage =
abstract endpointResolutionError: {| code: string; desc: string |} with get, set
abstract popUpWindowError: {| code: string; desc: string |} with get, set
abstract tokenRenewalError: {| code: string; desc: string |} with get, set
abstract invalidIdToken: {| code: string; desc: string |} with get, set
abstract invalidStateError: {| code: string; desc: string |} with get, set
abstract nonceMismatchError: {| code: string; desc: string |} with get, set
abstract loginProgressError: {| code: string; desc: string |} with get, set
abstract acquireTokenProgressError: {| code: string; desc: string |} with get, set
abstract userCancelledError: {| code: string; desc: string |} with get, set
abstract callbackError: {| code: string; desc: string |} with get, set
abstract userLoginRequiredError: {| code: string; desc: string |} with get, set
abstract userDoesNotExistError: {| code: string; desc: string |} with get, set
abstract clientInfoDecodingError: {| code: string; desc: string |} with get, set
abstract clientInfoNotPopulatedError: {| code: string; desc: string |} with get, set
abstract nullOrEmptyIdToken: {| code: string; desc: string |} with get, set
abstract idTokenNotParsed: {| code: string; desc: string |} with get, set
abstract tokenEncodingError: {| code: string; desc: string |} with get, set
abstract invalidInteractionType: {| code: string; desc: string |} with get, set
abstract cacheParseError: {| code: string; desc: string |} with get, set
abstract blockTokenRequestsInHiddenIframe: {| code: string; desc: string |} with get, set
module __error_ClientConfigurationError =
type ClientAuthError = __error_ClientAuthError.ClientAuthError
type TelemetryOptions = Configuration.TelemetryOptions
type [<AllowNullLiteral>] IExports =
abstract ClientConfigurationErrorMessage: obj
/// Error thrown when there is an error in configuration of the .js library.
abstract ClientConfigurationError: ClientConfigurationErrorStatic
type [<AllowNullLiteral>] IClientConfigurationErrorMessage =
abstract code: string with get, set
abstract desc: string with get, set
/// Error thrown when there is an error in configuration of the .js library.
type [<AllowNullLiteral>] ClientConfigurationError =
inherit ClientAuthError
/// Error thrown when there is an error in configuration of the .js library.
type [<AllowNullLiteral>] ClientConfigurationErrorStatic =
[<EmitConstructor>] abstract Create: errorCode: string * ?errorMessage: string -> ClientConfigurationError
abstract createNoSetConfigurationError: unit -> ClientConfigurationError
abstract createStorageNotSupportedError: givenCacheLocation: string -> ClientConfigurationError
abstract createRedirectCallbacksNotSetError: unit -> ClientConfigurationError
abstract createInvalidCallbackObjectError: callbackObject: obj -> ClientConfigurationError
abstract createEmptyScopesArrayError: scopesValue: string -> ClientConfigurationError
abstract createScopesNonArrayError: scopesValue: string -> ClientConfigurationError
abstract createScopesRequiredError: scopesValue: ResizeArray<string> -> ClientConfigurationError
abstract createInvalidPromptError: promptValue: string -> ClientConfigurationError
abstract createClaimsRequestParsingError: claimsRequestParseError: string -> ClientConfigurationError
abstract createEmptyRequestError: unit -> ClientConfigurationError
abstract createInvalidCorrelationIdError: unit -> ClientConfigurationError
abstract createKnownAuthoritiesNotSetError: unit -> ClientConfigurationError
abstract createInvalidAuthorityTypeError: unit -> ClientConfigurationError
abstract createUntrustedAuthorityError: host: string -> ClientConfigurationError
abstract createTelemetryConfigError: config: TelemetryOptions -> ClientConfigurationError
abstract createSsoSilentError: unit -> ClientConfigurationError
abstract createInvalidAuthorityMetadataError: unit -> ClientConfigurationError
module __error_InteractionRequiredAuthError =
type ServerError = __error_ServerError.ServerError
type [<AllowNullLiteral>] IExports =
abstract InteractionRequiredAuthErrorMessage: {| interactionRequired: {| code: string |}; consentRequired: {| code: string |}; loginRequired: {| code: string |} |}
/// Error thrown when the user is required to perform an interactive token request.
abstract InteractionRequiredAuthError: InteractionRequiredAuthErrorStatic
/// Error thrown when the user is required to perform an interactive token request.
type [<AllowNullLiteral>] InteractionRequiredAuthError =
inherit ServerError
/// Error thrown when the user is required to perform an interactive token request.
type [<AllowNullLiteral>] InteractionRequiredAuthErrorStatic =
[<EmitConstructor>] abstract Create: errorCode: string * ?errorMessage: string -> InteractionRequiredAuthError
abstract isInteractionRequiredError: errorString: string -> bool
abstract createLoginRequiredAuthError: errorDesc: string -> InteractionRequiredAuthError
abstract createInteractionRequiredAuthError: errorDesc: string -> InteractionRequiredAuthError
abstract createConsentRequiredAuthError: errorDesc: string -> InteractionRequiredAuthError
module __error_ServerError =
type AuthError = __error_AuthError.AuthError
type [<AllowNullLiteral>] IExports =
abstract ServerErrorMessage: {| serverUnavailable: {| code: string; desc: string |}; unknownServerError: {| code: string |} |}
/// Error thrown when there is an error with the server code, for example, unavailability.
abstract ServerError: ServerErrorStatic
/// Error thrown when there is an error with the server code, for example, unavailability.
type [<AllowNullLiteral>] ServerError =
inherit AuthError
/// Error thrown when there is an error with the server code, for example, unavailability.
type [<AllowNullLiteral>] ServerErrorStatic =
[<EmitConstructor>] abstract Create: errorCode: string * ?errorMessage: string -> ServerError
abstract createServerUnavailableError: unit -> ServerError
abstract createUnknownServerError: errorDesc: string -> ServerError
module __telemetry_ApiEvent =
type TelemetryEvent = __telemetry_TelemetryEvent.TelemetryEvent
type [<AllowNullLiteral>] IExports =
abstract EVENT_KEYS: IExportsEVENT_KEYS
abstract ApiEvent: ApiEventStatic
type [<RequireQualifiedAccess>] API_CODE =
| AcquireTokenRedirect = 2001
| AcquireTokenSilent = 2002
| AcquireTokenPopup = 2003
| LoginRedirect = 2004
| LoginPopup = 2005
| Logout = 2006
type [<StringEnum>] [<RequireQualifiedAccess>] API_EVENT_IDENTIFIER =
| [<CompiledName("AcquireTokenRedirect")>] AcquireTokenRedirect
| [<CompiledName("AcquireTokenSilent")>] AcquireTokenSilent
| [<CompiledName("AcquireTokenPopup")>] AcquireTokenPopup
| [<CompiledName("LoginRedirect")>] LoginRedirect
| [<CompiledName("LoginPopup")>] LoginPopup
| [<CompiledName("Logout")>] Logout
type [<AllowNullLiteral>] ApiEvent =
inherit TelemetryEvent
abstract apiEventIdentifier: string with set
abstract apiCode: float with set
abstract authority: string with set
abstract apiErrorCode: string with set
abstract tenantId: string with set
abstract accountId: string with set
abstract wasSuccessful: bool with get, set
abstract loginHint: string with set
abstract authorityType: string with set
abstract promptType: string with set
type [<AllowNullLiteral>] ApiEventStatic =
[<EmitConstructor>] abstract Create: correlationId: string * piiEnabled: bool * ?apiEventIdentifier: API_EVENT_IDENTIFIER -> ApiEvent
type [<AllowNullLiteral>] IExportsEVENT_KEYS =
abstract AUTHORITY: string with get, set
abstract AUTHORITY_TYPE: string with get, set
abstract PROMPT: string with get, set
abstract TENANT_ID: string with get, set
abstract USER_ID: string with get, set
abstract WAS_SUCESSFUL: string with get, set
abstract API_ERROR_CODE: string with get, set
abstract LOGIN_HINT: string with get, set
module __telemetry_CacheEvent =
type TelemetryEvent = __telemetry_TelemetryEvent.TelemetryEvent
type [<AllowNullLiteral>] IExports =
abstract CACHE_EVENT_TYPES: IExportsCACHE_EVENT_TYPES
abstract TOKEN_TYPE_KEY: string
abstract CacheEvent: CacheEventStatic
type [<StringEnum>] [<RequireQualifiedAccess>] TOKEN_TYPES =
| [<CompiledName("at")>] AT
| [<CompiledName("id")>] ID
| [<CompiledName("account")>] ACCOUNT
type [<AllowNullLiteral>] CacheEvent =
inherit TelemetryEvent
abstract tokenType: string with set
type [<AllowNullLiteral>] CacheEventStatic =
[<EmitConstructor>] abstract Create: eventName: string * correlationId: string -> CacheEvent
type [<AllowNullLiteral>] IExportsCACHE_EVENT_TYPES =
abstract TokenCacheLookup: string with get, set
abstract TokenCacheWrite: string with get, set
abstract TokenCacheBeforeAccess: string with get, set
abstract TokenCacheAfterAccess: string with get, set
abstract TokenCacheBeforeWrite: string with get, set
abstract TokenCacheDelete: string with get, set
module __telemetry_DefaultEvent =
type EventCount = __telemetry_TelemetryTypes.EventCount
type TelemetryPlatform = __telemetry_TelemetryTypes.TelemetryPlatform
type TelemetryEvent = __telemetry_TelemetryEvent.TelemetryEvent
type [<AllowNullLiteral>] IExports =
abstract DefaultEvent: DefaultEventStatic
type [<AllowNullLiteral>] DefaultEvent =
inherit TelemetryEvent
type [<AllowNullLiteral>] DefaultEventStatic =
[<EmitConstructor>] abstract Create: platform: TelemetryPlatform * correlationId: string * clientId: string * eventCount: EventCount -> DefaultEvent
module __telemetry_HttpEvent =
type StringDict = MsalTypes.StringDict
type TelemetryEvent = __telemetry_TelemetryEvent.TelemetryEvent
type [<AllowNullLiteral>] IExports =
abstract EVENT_KEYS: IExportsEVENT_KEYS
abstract HttpEvent: HttpEventStatic
type [<AllowNullLiteral>] HttpEvent =
inherit TelemetryEvent
abstract url: string with set
abstract httpPath: string with set
abstract userAgent: string with set
abstract queryParams: StringDict with set
abstract apiVersion: string with set
abstract httpResponseStatus: float with set
abstract oAuthErrorCode: string with set
abstract httpMethod: string with set
abstract requestIdHeader: string with set
/// Indicates whether the request was executed on a ring serving SPE traffic.
/// An empty string indicates this occurred on an outer ring, and the string "I"
/// indicates the request occurred on the inner ring
abstract speInfo: string with set
abstract serverErrorCode: string with set
abstract serverSubErrorCode: string with set
type [<AllowNullLiteral>] HttpEventStatic =
[<EmitConstructor>] abstract Create: correlationId: string * eventLabel: string -> HttpEvent
type [<AllowNullLiteral>] IExportsEVENT_KEYS =
abstract HTTP_PATH: string with get, set
abstract USER_AGENT: string with get, set
abstract QUERY_PARAMETERS: string with get, set
abstract API_VERSION: string with get, set
abstract RESPONSE_CODE: string with get, set
abstract O_AUTH_ERROR_CODE: string with get, set
abstract HTTP_METHOD: string with get, set
abstract REQUEST_ID_HEADER: string with get, set
abstract SPE_INFO: string with get, set
abstract SERVER_ERROR_CODE: string with get, set
abstract SERVER_SUB_ERROR_CODE: string with get, set
abstract URL: string with get, set
module __telemetry_TelemetryConstants =
type [<AllowNullLiteral>] IExports =
abstract EVENT_NAME_PREFIX: obj
abstract EVENT_NAME_KEY: obj
abstract START_TIME_KEY: obj
abstract ELAPSED_TIME_KEY: obj
abstract TELEMETRY_BLOB_EVENT_NAMES: IExportsTELEMETRY_BLOB_EVENT_NAMES
abstract TENANT_PLACEHOLDER: obj
type [<AllowNullLiteral>] IExportsTELEMETRY_BLOB_EVENT_NAMES =
abstract MsalCorrelationIdConstStrKey: string with get, set
abstract ApiTelemIdConstStrKey: string with get, set
abstract ApiIdConstStrKey: string with get, set
abstract BrokerAppConstStrKey: string with get, set
abstract CacheEventCountConstStrKey: string with get, set
abstract HttpEventCountTelemetryBatchKey: string with get, set
abstract IdpConstStrKey: string with get, set
abstract IsSilentTelemetryBatchKey: string with get, set
abstract IsSuccessfulConstStrKey: string with get, set
abstract ResponseTimeConstStrKey: string with get, set
abstract TenantIdConstStrKey: string with get, set
abstract UiEventCountTelemetryBatchKey: string with get, set
module __telemetry_TelemetryEvent =
type [<AllowNullLiteral>] IExports =
abstract TelemetryEvent: TelemetryEventStatic
type [<AllowNullLiteral>] TelemetryEvent =
abstract ``event``: obj option with get, set
abstract eventId: string with get, set
abstract stop: unit -> unit
abstract start: unit -> unit
abstract telemetryCorrelationId: string with get, set
abstract eventName: string
abstract get: unit -> obj
abstract key: string
abstract displayName: string
type [<AllowNullLiteral>] TelemetryEventStatic =
[<EmitConstructor>] abstract Create: eventName: string * correlationId: string * eventLabel: string -> TelemetryEvent
module __telemetry_TelemetryManager =
type TelemetryConfig = __telemetry_TelemetryTypes.TelemetryConfig
type TelemetryEmitter = __telemetry_TelemetryTypes.TelemetryEmitter
type API_EVENT_IDENTIFIER = __telemetry_ApiEvent.API_EVENT_IDENTIFIER
type TelemetryEvent = __telemetry_TelemetryEvent.TelemetryEvent
type ApiEvent = __telemetry_ApiEvent.ApiEvent
type HttpEvent = __telemetry_HttpEvent.HttpEvent
type Logger = Logger.Logger
type [<AllowNullLiteral>] IExports =
abstract TelemetryManager: TelemetryManagerStatic
type [<AllowNullLiteral>] TelemetryManager =
abstract startEvent: ``event``: TelemetryEvent -> unit
abstract stopEvent: ``event``: TelemetryEvent -> unit
abstract flush: correlationId: string -> unit
abstract createAndStartApiEvent: correlationId: string * apiEventIdentifier: API_EVENT_IDENTIFIER -> ApiEvent
abstract stopAndFlushApiEvent: correlationId: string * apiEvent: ApiEvent * wasSuccessful: bool * ?errorCode: string -> unit
abstract createAndStartHttpEvent: correlation: string * httpMethod: string * url: string * eventLabel: string -> HttpEvent
type [<AllowNullLiteral>] TelemetryManagerStatic =
[<EmitConstructor>] abstract Create: config: TelemetryConfig * telemetryEmitter: TelemetryEmitter * logger: Logger -> TelemetryManager
abstract getTelemetrymanagerStub: clientId: string * logger: Logger -> TelemetryManager
module __telemetry_TelemetryTypes =
//type TelemetryEmitter = __telemetry_TelemetryTypes.TelemetryEmitter
type TelemetryEvent = __telemetry_TelemetryEvent.TelemetryEvent
type [<AllowNullLiteral>] InProgressEvents =
[<EmitIndexer>] abstract Item: key: string -> TelemetryEvent with get, set
type [<AllowNullLiteral>] EventCount =
[<EmitIndexer>] abstract Item: eventName: string -> float with get, set
type [<AllowNullLiteral>] EventCountByCorrelationId =
[<EmitIndexer>] abstract Item: correlationId: string -> EventCount with get, set
type [<AllowNullLiteral>] CompletedEvents =
[<EmitIndexer>] abstract Item: correlationId: string -> Array<TelemetryEvent> with get, set
type [<AllowNullLiteral>] TelemetryEmitter =
[<Emit "$0($1...)">] abstract Invoke: events: Array<obj> -> unit
type [<AllowNullLiteral>] TelemetryPlatform =
abstract sdk: string option with get, set
abstract sdkVersion: string option with get, set
abstract applicationName: string with get, set
abstract applicationVersion: string with get, set
abstract networkInformation: NetworkInformation option with get, set
type [<AllowNullLiteral>] TelemetryConfig =
abstract platform: TelemetryPlatform with get, set
abstract onlySendFailureTelemetry: bool option with get, set
abstract clientId: string with get, set
type [<AllowNullLiteral>] NetworkInformation =
abstract connectionSpeed: string with get, set
module __telemetry_TelemetryUtils =
type [<AllowNullLiteral>] IExports =
abstract scrubTenantFromUri: string -> String
abstract hashPersonalIdentifier: string -> string
abstract prependEventNamePrefix: string -> string
abstract supportsBrowserPerformance: unit -> bool
abstract endBrowserPerformanceMeasurement: string -> string -> string -> unit
abstract startBrowserPerformanceMeasurement: string -> unit
module __telemetry_UiEvent =
type TelemetryEvent = __telemetry_TelemetryEvent.TelemetryEvent
type [<AllowNullLiteral>] IExports =
abstract EVENT_KEYS: {| USER_CANCELLED: string; ACCESS_DENIED: string |}
abstract UiEvent: UiEventStatic
type [<AllowNullLiteral>] UiEvent =
inherit TelemetryEvent
abstract userCancelled: bool with set
abstract accessDenied: bool with set
type [<AllowNullLiteral>] UiEventStatic =
[<EmitConstructor>] abstract Create: correlationId: string -> UiEvent
module __utils_AuthCacheUtils =
type AccessTokenCacheItem = __cache_AccessTokenCacheItem.AccessTokenCacheItem
type [<AllowNullLiteral>] IExports =
abstract AuthCacheUtils: AuthCacheUtilsStatic
type [<AllowNullLiteral>] AuthCacheUtils =
interface end
type [<AllowNullLiteral>] AuthCacheUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> AuthCacheUtils
abstract filterTokenCacheItemsByScope: tokenCacheItems: Array<AccessTokenCacheItem> * requestScopes: ResizeArray<string> -> Array<AccessTokenCacheItem>
abstract filterTokenCacheItemsByAuthority: tokenCacheItems: Array<AccessTokenCacheItem> * authority: string -> Array<AccessTokenCacheItem>
abstract filterTokenCacheItemsByDomain: tokenCacheItems: Array<AccessTokenCacheItem> * requestDomain: string -> Array<AccessTokenCacheItem>
module __utils_Constants =
type [<AllowNullLiteral>] IExports =
abstract Constants: ConstantsStatic
abstract SESSION_STORAGE: obj
abstract ResponseTypes: {| id_token: string; token: string; id_token_token: string |}
abstract DEFAULT_AUTHORITY: string
abstract AAD_INSTANCE_DISCOVERY_ENDPOINT: string
abstract WELL_KNOWN_SUFFIX: string
abstract BlacklistedEQParams: ResizeArray<SSOTypes>
abstract NetworkRequestType: {| GET: string; POST: string |}
/// <summary>
/// we considered making this "enum" in the request instead of string, however it looks like the allowed list of
/// prompt values kept changing over past couple of years. There are some undocumented prompt values for some
/// internal partners too, hence the choice of generic "string" type instead of the "enum"
/// </summary>
abstract PromptState: {| LOGIN: string; SELECT_ACCOUNT: string; CONSENT: string; NONE: string |}
/// Frame name prefixes for the hidden iframe created in silent frames
abstract FramePrefix: {| ID_TOKEN_FRAME: string; TOKEN_FRAME: string |}
type [<AllowNullLiteral>] Constants =
interface end
type [<AllowNullLiteral>] ConstantsStatic =
[<EmitConstructor>] abstract Create: unit -> Constants
abstract libraryName: string
abstract claims: string
abstract clientId: string
abstract adalIdToken: string
abstract cachePrefix: string
abstract scopes: string
abstract no_account: string
abstract upn: string
abstract domain_hint: string
abstract prompt_select_account: string
abstract prompt_none: string
abstract prompt: string
abstract response_mode_fragment: string
abstract resourceDelimiter: string
abstract cacheDelimiter: string
abstract popUpWidth: float with get, set
abstract popUpHeight: float with get, set
abstract login: string
abstract renewToken: string
abstract unknown: string
abstract ADFS: string
abstract homeAccountIdentifier: string
abstract common: string
abstract openidScope: string
abstract profileScope: string
abstract oidcScopes: Array<string>
abstract interactionTypeRedirect: InteractionType
abstract interactionTypePopup: InteractionType
abstract interactionTypeSilent: InteractionType
abstract inProgress: string
/// Keys in the hashParams
type [<StringEnum>] [<RequireQualifiedAccess>] ServerHashParamKeys =
| [<CompiledName("scope")>] SCOPE
| [<CompiledName("state")>] STATE
| [<CompiledName("error")>] ERROR
| [<CompiledName("error_description")>] ERROR_DESCRIPTION
| [<CompiledName("access_token")>] ACCESS_TOKEN
| [<CompiledName("id_token")>] ID_TOKEN
| [<CompiledName("expires_in")>] EXPIRES_IN
| [<CompiledName("session_state")>] SESSION_STATE
| [<CompiledName("client_info")>] CLIENT_INFO
type [<StringEnum>] [<RequireQualifiedAccess>] TemporaryCacheKeys =
| [<CompiledName("authority")>] AUTHORITY
| [<CompiledName("acquireTokenAccount")>] ACQUIRE_TOKEN_ACCOUNT
| [<CompiledName("session.state")>] SESSION_STATE
| [<CompiledName("state.login")>] STATE_LOGIN
| [<CompiledName("state.acquireToken")>] STATE_ACQ_TOKEN
| [<CompiledName("state.renew")>] STATE_RENEW
| [<CompiledName("nonce.idtoken")>] NONCE_IDTOKEN
| [<CompiledName("login.request")>] LOGIN_REQUEST
| [<CompiledName("token.renew.status")>] RENEW_STATUS
| [<CompiledName("urlHash")>] URL_HASH
| [<CompiledName("interaction.status")>] INTERACTION_STATUS
| [<CompiledName("redirect_request")>] REDIRECT_REQUEST
type [<StringEnum>] [<RequireQualifiedAccess>] PersistentCacheKeys =
| [<CompiledName("idtoken")>] IDTOKEN
| [<CompiledName("client.info")>] CLIENT_INFO
type [<StringEnum>] [<RequireQualifiedAccess>] ErrorCacheKeys =
| [<CompiledName("login.error")>] LOGIN_ERROR
| [<CompiledName("error")>] ERROR
| [<CompiledName("error.description")>] ERROR_DESC
type [<StringEnum>] [<RequireQualifiedAccess>] SSOTypes =
| [<CompiledName("account")>] ACCOUNT
| [<CompiledName("sid")>] SID
| [<CompiledName("login_hint")>] LOGIN_HINT
| [<CompiledName("organizations")>] ORGANIZATIONS
| [<CompiledName("consumers")>] CONSUMERS
| [<CompiledName("id_token")>] ID_TOKEN
| [<CompiledName("accountIdentifier")>] ACCOUNT_ID
| [<CompiledName("homeAccountIdentifier")>] HOMEACCOUNT_ID
type [<StringEnum>] [<RequireQualifiedAccess>] InteractionType =
| RedirectInteraction
| PopupInteraction
| SilentInteraction
module __utils_CryptoUtils =
type [<AllowNullLiteral>] IExports =
abstract CryptoUtils: CryptoUtilsStatic
type [<AllowNullLiteral>] CryptoUtils =
interface end
type [<AllowNullLiteral>] CryptoUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> CryptoUtils
/// <summary>Creates a new random GUID</summary>
/// <returns>string (GUID)</returns>
abstract createNewGuid: unit -> string
/// <summary>verifies if a string is GUID</summary>
/// <param name="guid" />
abstract isGuid: guid: string -> bool
/// <summary>Decimal to Hex</summary>
/// <param name="num" />
abstract decimalToHex: num: float -> string
/// <summary>encoding string to base64 - platform specific check</summary>
/// <param name="input" />
abstract base64Encode: input: string -> string
/// <summary>Decodes a base64 encoded string.</summary>
/// <param name="input" />
abstract base64Decode: input: string -> string
/// <summary>deserialize a string</summary>
/// <param name="query" />
abstract deserialize: query: string -> obj
module __utils_RequestUtils =
type AuthenticationParameters = AuthenticationParameters.AuthenticationParameters
type InteractionType = __utils_Constants.InteractionType
type StringDict = MsalTypes.StringDict
type [<AllowNullLiteral>] IExports =
abstract RequestUtils: RequestUtilsStatic
type [<AllowNullLiteral>] LibraryStateObject =
abstract id: string with get, set
abstract ts: float with get, set
abstract method: string with get, set
type [<AllowNullLiteral>] RequestUtils =
interface end
type [<AllowNullLiteral>] RequestUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> RequestUtils
/// <param name="request" />
/// <param name="isLoginCall" />
/// <param name="cacheStorage" />
/// <param name="clientId">validates all request parameters and generates a consumable request object</param>
abstract validateRequest: request: AuthenticationParameters * isLoginCall: bool * clientId: string * interactionType: InteractionType -> AuthenticationParameters
/// <param name="request" />
abstract validatePromptParameter: prompt: string -> unit
/// <param name="request" />
abstract validateEQParameters: extraQueryParameters: StringDict * claimsRequest: string -> StringDict
/// <param name="claimsRequest" />
abstract validateClaimsRequest: claimsRequest: string -> unit
/// <param name="userState">User-provided state value</param>
/// <returns>State string include library state and user state</returns>
abstract validateAndGenerateState: userState: string * interactionType: InteractionType -> string
/// <summary>Generates the state value used by the library.</summary>
/// <returns>Base64 encoded string representing the state</returns>
abstract generateLibraryState: interactionType: InteractionType -> string
/// <summary>Decodes the state value into a StateObject</summary>
/// <param name="state">State value returned in the request</param>
/// <returns>Parsed values from the encoded state value</returns>
abstract parseLibraryState: state: string -> LibraryStateObject
/// <param name="correlationId" />
abstract validateAndGenerateCorrelationId: correlationId: string -> string
/// <summary>Create a request signature</summary>
/// <param name="request" />
abstract createRequestSignature: request: AuthenticationParameters -> string
module __utils_ResponseUtils =
type AuthResponse = AuthResponse.AuthResponse
type Account = Account.Account
type IdToken = IdToken.IdToken
type ServerRequestParameters = ServerRequestParameters.ServerRequestParameters
type [<AllowNullLiteral>] IExports =
abstract ResponseUtils: ResponseUtilsStatic
type [<AllowNullLiteral>] ResponseUtils =
interface end
type [<AllowNullLiteral>] ResponseUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> ResponseUtils
abstract setResponseIdToken: originalResponse: AuthResponse * idTokenObj: IdToken -> AuthResponse
abstract buildAuthResponse: idToken: IdToken * authResponse: AuthResponse * serverAuthenticationRequest: ServerRequestParameters * account: Account * scopes: Array<string> * accountState: string -> AuthResponse
module __utils_StringUtils =
type AccessTokenKey = __cache_AccessTokenKey.AccessTokenKey
type [<AllowNullLiteral>] IExports =
abstract StringUtils: StringUtilsStatic
type [<AllowNullLiteral>] StringUtils =
interface end
type [<AllowNullLiteral>] StringUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> StringUtils
/// <summary>Check if a string is empty</summary>
/// <param name="str" />
abstract isEmpty: str: string -> bool
/// <summary>Check if a string's value is a valid JSON object</summary>
/// <param name="str" />
abstract validateAndParseJsonCacheKey: str: string -> AccessTokenKey
module __utils_TimeUtils =
type [<AllowNullLiteral>] IExports =
abstract TimeUtils: TimeUtilsStatic
type [<AllowNullLiteral>] TimeUtils =
interface end
type [<AllowNullLiteral>] TimeUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> TimeUtils
/// <summary>Returns time in seconds for expiration based on string value passed in.</summary>
/// <param name="expiresIn" />
abstract parseExpiresIn: expiresIn: string -> float
/// Return the current time in Unix time (seconds). Date.getTime() returns in milliseconds.
abstract now: unit -> float
/// Returns the amount of time in milliseconds since the page loaded.
abstract relativeNowMs: unit -> float
module __utils_TokenUtils =
type [<AllowNullLiteral>] IExports =
abstract TokenUtils: TokenUtilsStatic
type [<AllowNullLiteral>] TokenUtils =
interface end
type [<AllowNullLiteral>] TokenUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> TokenUtils
/// <summary>decode a JWT</summary>
/// <param name="jwtToken" />
abstract decodeJwt: jwtToken: string -> obj
/// <summary>Evaluates whether token cache item expiration is within expiration offset range</summary>
/// <param name="tokenCacheItem" />
abstract validateExpirationIsWithinOffset: expiration: float * tokenRenewalOffsetSeconds: float -> Boolean
/// <summary>Extract IdToken by decoding the RAWIdToken</summary>
/// <param name="encodedIdToken" />
abstract extractIdToken: encodedIdToken: string -> obj
module __utils_UrlUtils =
type IUri = IUri.IUri
type ServerRequestParameters = ServerRequestParameters.ServerRequestParameters
type [<AllowNullLiteral>] IExports =
abstract UrlUtils: UrlUtilsStatic
type [<AllowNullLiteral>] UrlUtils =
interface end
type [<AllowNullLiteral>] UrlUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> UrlUtils
/// <summary>generates the URL with QueryString Parameters</summary>
/// <param name="scopes" />
abstract createNavigateUrl: serverRequestParams: ServerRequestParameters -> string
/// <summary>Generate the array of all QueryStringParams to be sent to the server</summary>
/// <param name="scopes" />
abstract createNavigationUrlString: serverRequestParams: ServerRequestParameters -> Array<string>
/// Returns current window URL as redirect uri
abstract getCurrentUrl: unit -> string
/// Returns given URL with query string removed
abstract removeHashFromUrl: url: string -> string
/// <summary>Given a url like <see href="https://a:b/common/d?e=f#g," /> and a tenantId, returns <see href="https://a:b/tenantId/d" /></summary>
/// <param name="href">The url</param>
/// <param name="tenantId">The tenant id to replace</param>
abstract replaceTenantPath: url: string * tenantId: string -> string
abstract constructAuthorityUriFromObject: urlObject: IUri * pathArray: ResizeArray<string> -> string
/// <summary>Checks if an authority is common (ex. <see href="https://a:b/common/)" /></summary>
/// <param name="url">The url</param>
/// <returns>true if authority is common and false otherwise</returns>
abstract isCommonAuthority: url: string -> bool
/// <summary>Checks if an authority is for organizations (ex. <see href="https://a:b/organizations/)" /></summary>
/// <param name="url">The url</param>
/// <returns>true if authority is for and false otherwise</returns>
abstract isOrganizationsAuthority: url: string -> bool
/// <summary>Checks if an authority is for consumers (ex. <see href="https://a:b/consumers/)" /></summary>
/// <param name="url">The url</param>
/// <returns>true if authority is for and false otherwise</returns>
abstract isConsumersAuthority: url: string -> bool
/// <summary>Parses out the components from a url string.</summary>
/// <returns>An object with the various components. Please cache this value insted of calling this multiple times on the same url.</returns>
abstract GetUrlComponents: url: string -> IUri
/// <summary>Given a url or path, append a trailing slash if one doesnt exist</summary>
/// <param name="url" />
abstract CanonicalizeUri: url: string -> string
/// <summary>
/// Checks to see if the url ends with the suffix
/// Required because we are compiling for es5 instead of es6
/// </summary>
/// <param name="url" />
/// <param name="str" />
abstract endsWith: url: string * suffix: string -> bool
/// <summary>Utils function to remove the login_hint and domain_hint from the i/p extraQueryParameters</summary>
/// <param name="url" />
/// <param name="name" />
abstract urlRemoveQueryStringParameter: url: string * name: string -> string
abstract getHashFromUrl: urlStringOrFragment: string -> string
abstract urlContainsHash: urlString: string -> bool
abstract deserializeHash: urlFragment: string -> obj
/// <param name="URI" />
/// <returns>
/// host from the URI
///
/// extract URI from the host
/// </returns>
abstract getHostFromUri: uri: string -> string
module __utils_WindowUtils =
type Logger = Logger.Logger
type AuthCache = __cache_AuthCache.AuthCache
type [<AllowNullLiteral>] IExports =
abstract WindowUtils: WindowUtilsStatic
type [<AllowNullLiteral>] WindowUtils =
interface end
type [<AllowNullLiteral>] WindowUtilsStatic =
[<EmitConstructor>] abstract Create: unit -> WindowUtils
abstract isInIframe: unit -> bool
abstract isInPopup: unit -> bool
/// <param name="prefix" />
/// <param name="scopes" />
/// <param name="authority" />
abstract generateFrameName: prefix: string * requestSignature: string -> string
abstract monitorIframeForHash: contentWindow: Window * timeout: float * urlNavigate: string * logger: Logger -> Promise<string>
abstract monitorPopupForHash: contentWindow: Window * timeout: float * urlNavigate: string * logger: Logger -> Promise<string>
abstract loadFrame: urlNavigate: string * frameName: string * timeoutMs: float * logger: Logger -> Promise<HTMLIFrameElement>
/// <param name="urlNavigate" />
/// <param name="frameName" />
/// <param name="logger" />
abstract loadFrameSync: urlNavigate: string * frameName: string * logger: Logger -> HTMLIFrameElement
abstract addHiddenIFrame: iframeId: string * logger: Logger -> HTMLIFrameElement
abstract removeHiddenIframe: iframe: HTMLIFrameElement -> unit
abstract getIframeWithHash: hash: string -> HTMLIFrameElement
abstract getPopups: unit -> Array<Window>
abstract getPopUpWithHash: hash: string -> Window
abstract trackPopup: popup: Window -> unit
abstract closePopups: unit -> unit
abstract blockReloadInHiddenIframes: unit -> unit
/// <param name="cacheStorage" />
abstract checkIfBackButtonIsPressed: cacheStorage: AuthCache -> unit
/// Removes url fragment from browser url
abstract clearUrlFragment: contentWindow: Window -> unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment