OAuth2 Customize Sign-In HTML

When an OAuth2 client do a request to get a new Access Token, a Web-Page is shown in a web-browser to Allow this connection and login with an User and Password.

The HTML page is included by default in Server component, but this code can be customized using OnAuth2BeforeDispatchPage event.

procedure OnOAuth2BeforeDispatchPage(Sender: TObject; OAuth2: TsgcHTTPOAuth2Request; var HTML: string);
  HTML := 'your custom html';

If you customize your HTML with a completely new HTML code, at least you must maintain the form where the Username and password are sent:

<form action="">
<input type="hidden" name="request_type" value="sign-in" />
<input type="username" name="username" placeholder="Username" />
<input type="password" name="password" placeholder="Password" />
<input type="hidden" name="id" value="" />
<button>Sign In</button>

The id parameter, which is hidden, must maintain the same value of the original form to allow server identify the request.

Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

sgcWebSockets 4.4.5
OAuth2 Server Allow none authenticated requests

Related Posts