Skip to content

Declared in <galanthus/c_api/gln_capi.h>.

GLN_API gln_status_t GLN_CALL gln_wise_set_personal_token(
    gln_backend_t*      in_backend,
    const gln_secret_t* in_personal_token,
    gln_error_t*        out_error);
  • Family: Wise token setup
  • Return type: gln_status_t

Purpose

Persists a Wise personal token for an opened Wise backend.

The token enters through a gln_secret_t; the public C API returns only status and structured error information.

Return

Returns GLN_OK on success and a non-OK gln_status_t value on failure.

TypeNullabilityOwnership
gln_status_tvaluevalue

Parameters

NameDirectionTypeNullabilityOwnership
in_backendinputgln_backend_t*nonnullborrowed
in_personal_tokeninputconst gln_secret_t*nonnullborrowed
out_erroroutputgln_error_t*nullablecaller_allocated_output

Secret Input

in_personal_token is borrowed for the duration of the call and must be non-NULL and non-empty.

The implementation serializes the token into the backend's configured token storage and wipes transient token copies after use.

No token string is returned through the status code, error fields, JSON output, or any public result object.

Token Storage

On success, token state is persisted to one active sink: backend profile storage when a profile name was configured, otherwise the Wise token store bound to the backend.

Persistence failures return GLN_ERR_TOKEN_PERSIST_FAILED. Use token-persist error detail helpers to inspect the failing persistence operation.

The operation fails explicitly if token storage cannot be written; it does not report success for a degraded or skipped write.

Example

gln_secret_t* personal_token = NULL;
make_secret_from_prompt(&personal_token);

gln_error_t error = {0};

gln_default_error(&error);
gln_status_t rc = gln_wise_set_personal_token(backend, personal_token, &error);
if (rc != GLN_OK) {
    handle_token_setup_failure(&error);
}

gln_destroy_secret(personal_token);
gln_release_error(&error);

See Also