SnapdAuthData: snapd-glib Reference Manual

## SnapdAuthData SnapdAuthData — Authorization data |

## Functions

SnapdAuthData * | snapd_auth_data_new ()
const gchar * | snapd_auth_data_get_macaroon ()
GStrv | snapd_auth_data_get_discharges ()

## Properties

GStrv | discharges | Read / Write
char * | macaroon | Read / Write

## Types and Values

| SnapdAuthData

## Object Hierarchy

        GObject
        ╰── SnapdAuthData

## Includes

    #include <snapd-glib/snapd-glib.h>

## Description

A SnapdAuthData contains authorization data to communicate with snapd. Authenticating with `snapd_login_sync()` or `snapd_client_login_sync()` returns authorization data that can be used for requests by calling `snapd_client_set_auth_data()`.

It is recommended that the data is securely stored between sessions so authentication is not required to be repeated. The authorization data is made up of printable strings that can be easily written to a file/database.

## Functions

### snapd_auth_data_new ()

    SnapdAuthData *
    snapd_auth_data_new (const gchar *macaroon,
                         GStrv discharges);

Create some authorization data.

#### Parameters

macaroon | serialized macaroon used to authorize access to snapd. |
discharges | serialized discharges. | [array zero-terminated=1]

#### Returns

a new SnapdAuthData

Since: 1.0

### snapd_auth_data_get_macaroon ()

    const gchar *
    snapd_auth_data_get_macaroon (SnapdAuthData *auth_data);

Get the Macaroon that this authorization uses.

#### Parameters

auth_data | a SnapdAuthData. |

#### Returns

the serialized Macaroon used to authorize access to snapd.

Since: 1.0

### snapd_auth_data_get_discharges ()

    GStrv
    snapd_auth_data_get_discharges (SnapdAuthData *auth_data);

Get the discharges that this authorization uses.

#### Parameters

auth_data | a SnapdAuthData. |

#### Returns

the discharges as serialized strings.

[transfer none][array zero-terminated=1]

Since: 1.0

## Types and Values

### SnapdAuthData

    typedef struct _SnapdAuthData SnapdAuthData;

SnapdAuthData contains authorization data used to communicate with snapd.

The authorization data is in the form of a Macaroon.

Since: 1.0

## Property Details

### The `“discharges”` property

      “discharges”               GStrv

Serialized discharges.

Owner: SnapdAuthData

Flags: Read / Write

### The `“macaroon”` property

      “macaroon”                 char *

Serialized macaroon.

Owner: SnapdAuthData

Flags: Read / Write

Default value: NULL