2023.5.3-1685668677 • Published 2 years ago

@cwcpierre-ak/api v2023.5.3-1685668677

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

@goauthentik/api

This package provides a generated API Client for authentik.

Building

See https://goauthentik.io/developer-docs/making-schema-changes

Consuming

npm install @goauthentik/api --save

Create a configuration:

import { Configuration } from "@goauthentik/api";

export const DEFAULT_CONFIG = new Configuration({
    // Configure where the API is located
    // Can be a full host, ensure CORS is configured
    basePath: "",
    // Required for POST/PUT/DELETE requests
    // getCookie function must return the cookie's contents
    headers: {
        "X-authentik-CSRF": getCookie("authentik_csrf"),
    },
});

Then use the API:

import { CoreApi } from "@goauthentik/api";

const user = await new CoreApi(DEFAULT_CONFIG).coreUsersMeRetrieve();