adonis-prisma icon indicating copy to clipboard operation
adonis-prisma copied to clipboard

Token provider

Open WailRoth opened this issue 2 years ago • 1 comments

In the readme, we understand how to implement prisma with auth. But for web api using token, what should be the config for the auth.ts for the token provider ? Thanks.

WailRoth avatar Aug 13 '23 11:08 WailRoth

This is what I used in my config

import type { AuthConfig } from "@ioc:Adonis/Addons/Auth";

const authConfig: AuthConfig = {
  guard: "api",
  guards: {
    api: {
      driver: "oat",
      tokenProvider: {
        type: "api",
        driver: "redis",
        redisConnection: "local",
        foreignKey: "user_id",
      },

      provider: {
        driver: "prisma",
        identifierKey: "id",
        uids: ["email"],
        model: "user",
      },
    },
  },
};

export default authConfig;

michaelcosj avatar Aug 20 '23 23:08 michaelcosj