extract_authorization_code


Description:

public abstract bool extract_authorization_code (Source source, string page_title, string page_uri, string? page_content, out string out_authorization_code)

Tries to extract an authorization code from a web page provided by the server.

The function can be called multiple times, whenever the page load is finished. The default implementation uses util_extract_from_uri to get the code from the given page_uri.

There can happen three states: 1) either the this cannot determine the authentication code from the page information, then the false is returned and the out_authorization_code is left untouched; or 2) the server reported a failure, in which case the function returns true and lefts the out_authorization_code untouched; or 3) the this could extract the authentication code from the given arguments, then the function returns true and sets the received authorization code to out_authorization_code.

The page_content is null, unless flags returned by get_flags contain also EXTRACT_REQUIRES_PAGE_CONTENT.

This method is always called after get_authentication_policy.

Parameters:

this

an OAuth2Service

source

an associated Source

page_title

a web page title

page_uri

a web page URI

page_content

a web page content

out_authorization_code

the extracted authorization code

Returns:

whether could recognized successful or failed server response. The out_authorization_code is populated on success too.