GsAuth: GNOME Software Reference Manual

## GsAuth GsAuth — User data used for authentication |

## Stability Level

Unstable, unless otherwise indicated

## Functions

GsAuth * | gs_auth_new ()
const gchar * | gs_auth_get_header ()
void | gs_auth_set_header ()
const gchar * | gs_auth_get_auth_id ()
const gchar * | gs_auth_get_provider_name ()
void | gs_auth_set_provider_name ()
const gchar * | gs_auth_get_provider_type ()
GoaObject * | gs_auth_peek_goa_object ()
void | gs_auth_set_goa_object ()

## Types and Values

#define | GS_TYPE_AUTH
| GsAuth

## Includes

    #include <gnome-software.h>

## Description

This object represents user data used for authentication. This data is shared between all plugins.

## Functions

### gs_auth_new ()

    GsAuth *
    gs_auth_new (const gchar *auth_id,
                 const gchar *provider_type,
                 GError **error);

#### Parameters

auth_id | an identifier used for mapping, e.g. "snapd" |
provider_type | the name of the GoaProvider466 to be used, e.g. "ubuntusso" |
error | A GError |

#### Returns

a new GsAuth object.

[transfer full][nullable]

### gs_auth_get_header ()

    const gchar *
    gs_auth_get_header (GsAuth *auth,
                        guint n);

Gets the header to be used in the authentication dialog in case there are `n` available accounts.

#### Parameters

auth | a GsAuth |
n | the number of accounts |

#### Returns

(transfer none) : a string

### gs_auth_set_header ()

    void
    gs_auth_set_header (GsAuth *auth,
                        const gchar *header_none,
                        const gchar *header_single,
                        const gchar *header_multiple);

Sets the headers to be used for the authentication dialog.

#### Parameters

auth | a GsAuth |
header_none | the header to be used if no account is present |
header_single | the header to be used if one account is present |
header_multiple | the header to be used if two or more accounts are present |

### gs_auth_get_auth_id ()

    const gchar *
    gs_auth_get_auth_id (GsAuth *auth);

Gets the authentication service ID.

#### Parameters

auth | a GsAuth |

#### Returns

a string.

[transfer none]

### gs_auth_get_provider_name ()

    const gchar *
    gs_auth_get_provider_name (GsAuth *auth);

Gets the authentication service name.

#### Parameters

auth | a GsAuth |

#### Returns

a string.

[transfer none]

### gs_auth_set_provider_name ()

    void
    gs_auth_set_provider_name (GsAuth *auth,
                               const gchar *provider_name);

Sets the name to be used for the authentication dialog.

#### Parameters

auth | a GsAuth |
provider_name | a service name, e.g. "Snap Store" |

### gs_auth_get_provider_type ()

    const gchar *
    gs_auth_get_provider_type (GsAuth *auth);

Gets the GoaProvider type to be used for the authentication dialog.

#### Parameters

auth | a GsAuth |

#### Returns

a string.

[transfer none]

### gs_auth_peek_goa_object ()

    GoaObject *
    gs_auth_peek_goa_object (GsAuth *auth);

Gets the logged GoaObject if any.

#### Parameters

auth | a GsAuth |

#### Returns

a GoaObject, or `NULL`.

[transfer none][nullable]

### gs_auth_set_goa_object ()

    void
    gs_auth_set_goa_object (GsAuth *auth,
                            GoaObject *goa_object);

Set the GoaObject used to login in.

#### Parameters

auth | a GsAuth |
goa_object | (nullable) a GoaObject |

## Types and Values

### GS_TYPE_AUTH

    #define GS_TYPE_AUTH (gs_auth_get_type ())

### GsAuth

    typedef struct _GsAuth GsAuth;