From ada093ac3b754ac345751e7a096d967cbeee754a Mon Sep 17 00:00:00 2001 From: ndom91 Date: Wed, 28 Jul 2021 20:42:14 +0200 Subject: [PATCH] docs(providers): add tip about async provider code --- www/docs/configuration/options.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/www/docs/configuration/options.md b/www/docs/configuration/options.md index 872bf97e9f..794104bac8 100644 --- a/www/docs/configuration/options.md +++ b/www/docs/configuration/options.md @@ -44,6 +44,21 @@ Options are passed to NextAuth.js when initializing it in an API route. An array of authentication providers for signing in (e.g. Google, Facebook, Twitter, GitHub, Email, etc) in any order. This can be one of the built-in providers or an object with a custom provider. +If you need to use an asynchronous function in your provider instantiation, you can setup your `[...nextauth].js` file like so: + +```js +export default async function handler(req, res) { + NextAuth(req, res, { + providers: [ + Providers.IdentityServer4({ + id: "identity-server", + clientSecret: await GetSecret(), + }), + ], + }) +} +``` + See the [providers documentation](/configuration/providers) for a list of supported providers and how to use them. ---