Top |
Description
Support for OAuth 2.0 access tokens is typically provided through
dynamically loaded modules. The module will provide an extension
class which implements the EOAuth2SupportInterface, which can be
plugged into all appropriate EServerSideSource instances through
e_server_side_source_set_oauth2_support()
. Incoming requests for
access tokens are then forwarded to the extension providing OAuth
2.0 support through e_oauth2_support_get_access_token()
.
Functions
e_oauth2_support_get_access_token_sync ()
gboolean e_oauth2_support_get_access_token_sync (EOAuth2Support *support
,ESource *source
,GCancellable *cancellable
,gchar **out_access_token
,gint *out_expires_in
,GError **error
);
Obtains the OAuth 2.0 access token for source
along with its expiry
in seconds from the current time (or 0 if unknown).
Free the returned access token with g_free()
when finished with it.
If an error occurs, the function will set error
and return FALSE
.
Since: 3.8
e_oauth2_support_get_access_token ()
void e_oauth2_support_get_access_token (EOAuth2Support *support
,ESource *source
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously obtains the OAuth 2.0 access token for source
along
with its expiry in seconds from the current time (or 0 if unknown).
When the operation is finished, callback
will be called. You can then
call e_oauth2_support_get_access_token_finish()
to get the result of the
operation.
Parameters
support |
||
source |
an ESource |
|
cancellable |
optional GCancellable object, or |
|
callback |
a GAsyncReadyCallback to call when the request is satisfied |
|
user_data |
data to pass to the callback function |
Since: 3.8
e_oauth2_support_get_access_token_finish ()
gboolean e_oauth2_support_get_access_token_finish (EOAuth2Support *support
,GAsyncResult *result
,gchar **out_access_token
,gint *out_expires_in
,GError **error
);
Finishes the operation started with e_oauth2_support_get_access_token()
.
Free the returned access token with g_free()
when finished with it.
If an error occurred, the function will set error
and return FALSE
.
Parameters
Since: 3.8
Types and Values
struct EOAuth2SupportInterface
struct EOAuth2SupportInterface { GTypeInterface parent_interface; /* Synchronous I/O Methods */ gboolean (*get_access_token_sync) (EOAuth2Support *support, ESource *source, GCancellable *cancellable, gchar **out_access_token, gint *out_expires_in, GError **error); /* Asynchronous I/O Methods (all have defaults) */ void (*get_access_token) (EOAuth2Support *support, ESource *source, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gboolean (*get_access_token_finish) (EOAuth2Support *support, GAsyncResult *result, gchar **out_access_token, gint *out_expires_in, GError **error); };
Since: 3.8