Login & Logout
#
LoginFor logging in a user you can call the authorize()
method:
The supplied configuration will be used and the user will be redirected to the Security Token Service to log into your app.
The configuration on server and client side has to be valid to finish the login successfully!
ConfigId
Parameter#
In case you have multiple configs you can pass the configId
parameter as the first argument to select a specific config:
#
AuthOptionsYou can pass in AuthOptions following optional parameters:
urlHandler
- to manipulate the behavior of the login with a customurlHandler
customParams
- to send custom parameters to OIDC ProviderredirectUrl
- to override the redirectUrl defined in the configuration
#
Login using a PopupYou can authenticate with any OpenID Connect identity provider using a popup.
This allows you to have the provider's consent prompt display in a popup window to avoid unloading and reloading the app.
#
Sample#
PopupOptionsYou can pass options to control the dimension of the popup with the PopupOptions
interface as a second parameter.
ConfigId
Parameter#
In case you have multiple configs you can pass the configId
parameter as the last argument.
#
Using custom popup login pageYou can pass a custom login page in AuthOptions (authOptions.redirectUrl).
A simplified page (instead of the application url) can be used. Here's an example:
#
Popup Sample#
LogoutThe logoff()
method sends an end session request to the OIDC server, if it is available, or the check session has not sent a changed event.
#
Parameters#
configIdlogoff()
also accepts a configId
paramater to select a specific config:
#
LogoutAuthOptionsYou can pass in LogoutAuthOptions following optional parameters:
urlHandler
- to manipulate the behavior of the logout with a customurlHandler
customParams
- to send custom parameters to OIDC ProviderlogoffMethod
- Which can beGET
orPOST
.GET
is default here.
According to the OIDC Standard only the customParams state
, logout_hint
and ui_locales
are configurable. Other values are being created, being read from storage or taken from your config.
You can pass an logoutAuthOptions
parameter if you want to control the behavior more.
If you prefer to send a POST logout request:
logoffAndRevokeTokens()
#
The logoffAndRevokeTokens()
method revokes the access token and the refresh token if using a refresh flow, and then logoff like above.
or an example using the LogoutAuthOptions parameters:
The method also takes configId
and logoutAuthOptions
parameters if needed.
logoffLocal()
#
The logoffLocal()
method is used to reset your local session in the browser, but does not send anything to the server. It also accepts the configId
parameter.