ESoupAuthBearer: Evolution-Data-Server Reference Manual

## ESoupAuthBearer ESoupAuthBearer — OAuth 2.0 support for libsoup |

## Functions

void | e_soup_auth_bearer_set_access_token ()
gboolean | e_soup_auth_bearer_is_expired ()
void | e_soup_auth_bearer_clear_rejected ()

## Types and Values

struct | ESoupAuthBearer

## Object Hierarchy

        GObject
        ╰── SoupAuth
            ╰── ESoupAuthBearer

## Includes

    #include <libedataserver/libedataserver.h>

## Description

ESoupAuthBearer adds libsoup support for the use of bearer tokens in HTTP requests to access OAuth 2.0 protected resources, as defined in

RFC 6750.

An EBackend should integrate ESoupAuthBearer first by adding it as a feature to a SoupSession's SoupAuthManager, then from a SoupSession “authenticate” handler call `e_source_get_oauth2_access_token()` and pass the results to `e_soup_auth_bearer_set_access_token()`.

## Functions

### e_soup_auth_bearer_set_access_token ()

    void
    e_soup_auth_bearer_set_access_token (ESoupAuthBearer *bearer,
                                         const gchar *access_token,
                                         gint expires_in_seconds);

This function is analogous to `soup_auth_authenticate()` for "Basic" HTTP authentication, except it takes an OAuth 2.0 access token instead of a username and password.

If `expires_in_seconds` is greater than zero, `soup_auth_is_authenticated()` will return `FALSE` after the given number of seconds have elapsed.

#### Parameters

bearer | an ESoupAuthBearer |
access_token | an OAuth 2.0 access token |
expires_in_seconds | expiry for `access_token` , or 0 if unknown |

Since: 3.10

### e_soup_auth_bearer_is_expired ()

    gboolean
    e_soup_auth_bearer_is_expired (ESoupAuthBearer *bearer);

#### Parameters

bearer | an ESoupAuthBearer |

#### Returns

Whether the set token is expired. It is considered expired even if the `e_soup_auth_bearer_set_access_token()` was called set yet.

Since: 3.24

### e_soup_auth_bearer_clear_rejected ()

    void
    e_soup_auth_bearer_clear_rejected (ESoupAuthBearer *bearer);

Clears the rejection flag set when the server responds with 401 Unauthorized. The time-based token expiry is preserved, so the existing token can be re-sent without a redundant token refresh from the credential provider.

#### Parameters

bearer | an ESoupAuthBearer |

Since: 3.62

## Types and Values

### struct ESoupAuthBearer

    struct ESoupAuthBearer;

Since: 3.10