Table of Contents

TSphinxLogin.Login Method

Starts the process to login to the application.

Remarks

The method follows this sequence: 1. If the user is already logged in (valid, non-expired tokens exist), the OnUserLoggedIn event is fired immediately with the cached result and no network request is made. 2. 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 without opening a browser. If the refresh fails for any reason, the method falls through to step 3. 3. If no valid tokens exist and silent refresh is not possible or failed, the user's default browser is launched to open the Sphinx login page. The user authenticates there, and Sphinx redirects the browser back to a localhost callback URL. An internal HTTP server processes the authorization code, requests the tokens, saves them in memory, and fires OnUserLoggedIn on the main thread. To obtain refresh tokens so that silent refresh works on subsequent calls, include the offline_access scope in the Scope property.

Syntax

Unit: Sphinx.Login

procedure TSphinxLogin.Login;

See also