Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

Feature Request - Adapter Implementation #259

Open
RedZepplin opened this issue Nov 15, 2022 · 1 comment
Open

Feature Request - Adapter Implementation #259

RedZepplin opened this issue Nov 15, 2022 · 1 comment

Comments

@RedZepplin
Copy link

Hi Guys,

Amazing work you've done here this project of yours has really helped me,

I'm currently implementing Auth via the google identity platform, and I'm sure I could probably implement something directly with firebase but would love to keep using this module, the only thing really stopping me is adapters aren't implemented,

https://next-auth.js.org/adapters/overview
https://next-auth.js.org/adapters/firebase

Probably just need to add the property definition "adaptor" to the AuthConfig type def, although not sure how the other dependencies might work

Keystone.ts would then look something like this

const auth = createAuth({
  listKey: 'User',
  identityField: 'subjectId',
  sessionData: `id name email`,
  autoCreate: true,
  resolver: async ({user, profile, account}) => {
    const username = user.name as string;
    const email = user.email as string;
    return { email, username };
  },

  keystonePath: '/admin',
  sessionSecret,
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_ID || "Google Cloud Client ID",
      clientSecret: process.env.GOOGLE_SECRET || "Google Cloud Client Secret",
    }),
  ],
  
  adapter: FirestoreAdapter({
  apiKey: process.env.FIREBASE_API_KEY,
  appId: process.env.FIREBASE_APP_ID,
  authDomain: process.env.FIREBASE_AUTH_DOMAIN,
  databaseURL: process.env.FIREBASE_DATABASE_URL,
  projectId: process.env.FIREBASE_PROJECT_ID,
  storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
  messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID,
  // Optional emulator config (see below for options)
  emulator: {},

}),
});

Much love
Juan H

@borisno2
Copy link
Member

Hey @RedZepplin thanks for reaching out. I'll have a look when I get a chance to see how easy this might be - it could be fairly straight forward. Also happy for a PR if it is something you are interested in looking at.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants