This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/scripts/web_api_readme.md
Jens Langhammer 02b4173d30 root: add utm_source
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-10-20 16:34:39 +02:00

867 B

@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-CSRFToken": getCookie("authentik_csrf"),
    },
});

Then use the API:

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

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