snapd_login(): snapd-glib Reference Manual

## snapd_login() snapd_login() — Client authorization |

## Functions

SnapdAuthData * | snapd_login_sync ()
void | snapd_login_async ()
SnapdAuthData * | snapd_login_finish ()

## Includes

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

## Description

Deprecated methods of authenticating with snapd.

## Functions

### snapd_login_sync ()

    SnapdAuthData *
    snapd_login_sync (const gchar *username,
                      const gchar *password,
                      const gchar *otp,
                      GCancellable *cancellable,
                      GError **error);

`snapd_login_sync` has been deprecated since version 1.34 and should not be used in newly-written code.

Use `snapd_client_login2_sync()`

This call used to contact a D-Bus service to perform snapd authentication using Polkit. This now just creates a SnapdClient and does the call directly.

#### Parameters

username | username to log in with. |
password | password to log in with. |
otp | response to one-time password challenge. | [allow-none]
cancellable | a GCancellable or `NULL`. | [allow-none]
error | GError location to store the error occurring, or `NULL` to ignore. | [allow-none]

#### Returns

a SnapdAuthData or `NULL` on error.

[transfer full]

Since: 1.0

### snapd_login_async ()

    void
    snapd_login_async (const gchar *username,
                       const gchar *password,
                       const gchar *otp,
                       GCancellable *cancellable,
                       GAsyncReadyCallback callback,
                       gpointer user_data);

`snapd_login_async` has been deprecated since version 1.34 and should not be used in newly-written code.

Use `snapd_client_login2_async()`

Asynchronously get authorization to install/remove snaps. See `snapd_login_sync()` for more information.

#### Parameters

username | username to log in with. |
password | password to log in with. |
otp | response to one-time password challenge. | [allow-none]
cancellable | a GCancellable or `NULL`. | [allow-none]
callback | a GAsyncReadyCallback to call when the request is satisfied. | [scope async]
user_data | the data to pass to callback function. | [closure]

Since: 1.0

### snapd_login_finish ()

    SnapdAuthData *
    snapd_login_finish (GAsyncResult *result,
                        GError **error);

`snapd_login_finish` has been deprecated since version 1.34 and should not be used in newly-written code.

Use `snapd_client_login2_finish()`

Complete login started with `snapd_login_async()`. See `snapd_login_sync()` for more information.

#### Parameters

result | a GAsyncResult. |
error | GError location to store the error occurring, or `NULL` to ignore. | [allow-none]

#### Returns

a SnapdAuthData or `NULL` on error.

[transfer full]

Since: 1.0