Constructor for the login client.
Contains the parameters provided to the OAuth API
OAuth Options set for the client
Thin wrapper around the built-in browser function fetch(), that adds the appropriate "Authorization" header necessary for calls to pCon.login
Please refer to the documentation of fetch() for more details on parameters and the return value. https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
The resource you want to fetch. Either the URL as string, or a Request object
An object containing any custom settings that you want to apply to the request.
Promise, resolves to null if there is no valid access token and login process should be triggered. else returns Promise returned by fetch
Obtain a valid access token. Unless the optional parameter "force_new" is true, this may be a previously cached token. If the returned Promise resolves to null, the application should display the user an appropriate error dialog and restart the login process to obtain valid tokens again.
If true, always refreshes token beforehand
Access token, if available, else null
Gets user data stored when logging in.
Generate Authorization URI for login. Can be used to create your own URI to redirect to or to open in Popup.
This should be called after handleRedirect finished, i.e. the returned promise resolved without error. This will make the access token available in your application.
This should be called from your redirect URI, after the authorization API endpoint has redirected you to your redirect_uri you set in the constructor. If you
This will handle the parameters provided by the authorization API and obtain the access token.
The returned promise will resolve, after the access token has been obtained.
Returns the Promise received by the fetch call after parsing the access token
Checks if an access token is available and if it has expired.
This is only deducted from information locally available, without a call to the server. It is possible the access token has been invalidated externally, e.g. if the user logs out from elsewhere or by changing password.
true, if access token is valid, false if not
Start login process by redirecting the browser to the authorization endpoint.
NOTE: This means the current state of the page will be lost!
The page you want to redirect to using redirectToNext. If this parameter is not provided, the library will set the "next" location to the current window.location
The application data you want to store until after the login process. Will be available after authorization using getAppData
Revokes access/refresh tokens and logs the user out from pCon.
NOTE: As the logout process involves a redirect, the page state will be lost.
If you want the user to return to your application after the logout you can pass an appropriate URL as the "next" parameter.
Page to redirect to after logging out
Redirects to next parameter. If next parameter was specified in loginWithRedirect, it's redirected there, else it will redirect to the location loginWithRedirect was called from.
Generated using TypeDoc
Client for the PCon Login OAuth API