TSphinxWebLogin.Login Method
Starts the process to login to the web application.
Remarks
The method follows this sequence: 1. If the current page URL contains a valid authorization callback (state parameter matching a pending request), the authorization code is exchanged for tokens, the tokens are saved in browser local storage, and OnUserLoggedIn is fired. No further steps are taken.
2. If the user is already logged in (valid, non-expired tokens in local storage), OnUserLoggedIn is fired immediately with the cached result.
3. If the stored tokens are expired but a refresh token is available, a silent token refresh is attempted. If the refresh succeeds, OnUserLoggedIn is fired with the new tokens. If the refresh fails, the browser is redirected to the Sphinx login page (step 4).
4. The browser is redirected to the Sphinx login page. After successful authentication, Sphinx redirects back to the URL in RedirectUri. The web application reloads and step 1 processes the authorization code.
To obtain refresh tokens so that silent refresh works on subsequent calls, include the offline_access scope in the Scope property.
Syntax
Unit: Sphinx.WebLogin
procedure TSphinxWebLogin.Login;