Functions¶
Table of contents¶
Functions¶
fetch¶
▸ Constfetch(url: RequestInfo, init?: RequestInit): Promise<Response>
This function’s signature is equal to window.fetch, but if the current user is authenticated
(see login and handleIncomingRedirect), requests made using it will include that user’s
credentials. If not, this will behave just like the regular window.fetch.
see https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch
since 1.3.0
Parameters:¶
Name |
Type |
|---|---|
|
RequestInfo |
|
RequestInit |
Returns: Promise<Response>
Defined in: browser/src/defaultSession.ts:51
getClientAuthenticationWithDependencies¶
▸ getClientAuthenticationWithDependencies(dependencies: { insecureStorage?: IStorage ; secureStorage?: IStorage }): ClientAuthentication
deprecated This function will be removed from the external API in an upcoming release.
getDefaultSession¶
▸ getDefaultSession(): Session
Obtain the Session used when not explicitly instantiating one yourself.
When using the top-level exports fetch, login, logout, handleIncomingRedirect, onLogin and onLogout, these apply to an implicitly-instantiated Session. This function returns a reference to that Session in order to obtain e.g. the current user’s WebID.
since 1.3.0
Returns: Session
Defined in: browser/src/defaultSession.ts:36
handleIncomingRedirect¶
▸ ConsthandleIncomingRedirect(url?: string): Promise<undefined | ISessionInfo>
Completes the login process by processing the information provided by the Solid identity provider through redirect.
since 1.3.0
Parameters:¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
string |
… |
The URL of the page handling the redirect, including the query parameters — these contain the information to process the login. |
Returns: Promise<undefined | ISessionInfo>
Defined in: browser/src/defaultSession.ts:85
login¶
▸ Constlogin(options: ILoginInputOptions): Promise<void>
Triggers the login process. Note that this method will redirect the user away from your app.
since 1.3.0
Parameters:¶
Name |
Type |
Description |
|---|---|---|
|
Parameter to customize the login behaviour. In particular, two options are mandatory: |
Returns: Promise<void>
This method should redirect the user away from the app: it does not return anything. The login process is completed by handleIncomingRedirect.
Defined in: browser/src/defaultSession.ts:63
logout¶
▸ Constlogout(): Promise<void>
Logs the user out of the application. This does not log the user out of their Solid identity provider, and should not redirect the user away.
since 1.3.0
Returns: Promise<void>
Defined in: browser/src/defaultSession.ts:74
onLogin¶
▸ ConstonLogin(callback: () => unknown): void
Register a callback function to be called when a user completes login.
The callback is called when handleIncomingRedirect completes successfully.
since 1.3.0
Parameters:¶
Name |
Type |
Description |
|---|---|---|
|
() => unknown |
The function called when a user completes login. |
Returns: void
Defined in: browser/src/defaultSession.ts:100
onLogout¶
▸ ConstonLogout(callback: () => unknown): void
Register a callback function to be called when a user logs out:
since 1.3.0
Parameters:¶
Name |
Type |
Description |
|---|---|---|
|
() => unknown |
The function called when a user completes logout. |
Returns: void
Defined in: browser/src/defaultSession.ts:111
onSessionRestore¶
▸ ConstonSessionRestore(callback: (currentUrl: string) => unknown): void
Register a callback function to be called when a session is restored:
since 1.3.0
Parameters:¶
Name |
Type |
Description |
|---|---|---|
|
( |
The function called when a session is restored. |
Returns: void
Defined in: browser/src/defaultSession.ts:122