Skip to content

Authentication

Access token

The API Client will automatically try to refresh the accessToken when necessary.

Login

ts
function login(email: string, password: string): Promise<void>;
ts
import { pmApiClient } from "@photomotionbv/customer-api-sdk";

pmApiClient.auth
  .login("email", "password")
  .then(() => {
    // authenticated
  })
  .catch((error) => {
    // not authenticated
    // error: e.g. "username or password is incorrect";
  });

Logout

ts
function logout(): Promise<void>;
ts
import { pmApiClient } from "@photomotionbv/customer-api-sdk";

pmApiClient.auth
  .logout()
  .then(() => {
    // logged out
  })
  .catch((error) => {
    console.log(error);
  });