Method

EDataServerOAuth2Serviceextract_authorization_code

since: 3.28

Declaration [src]

gboolean
e_oauth2_service_extract_authorization_code (
  EOAuth2Service* service,
  ESource* source,
  const gchar* page_title,
  const gchar* page_uri,
  const gchar* page_content,
  gchar** out_authorization_code
)

Description [src]

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 e_oauth2_service_util_extract_from_uri() to get the code from the given page_uri.

There can happen three states: 1) either the service 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 service 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 e_oauth2_service_get_flags() contain also E_OAUTH2_SERVICE_FLAG_EXTRACT_REQUIRES_PAGE_CONTENT.

This method is always called after e_oauth2_service_get_authentication_policy().

Available since: 3.28

Parameters

source

Type: ESource

An associated ESource.

The data is owned by the caller of the method.
page_title

Type: const gchar*

A web page title.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
page_uri

Type: const gchar*

A web page URI.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
page_content

Type: const gchar*

A web page content.

The argument can be NULL.
The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
out_authorization_code

Type: gchar**

The extracted authorization code.

The argument will be set by the function.
The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.

Return value

Type: gboolean

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