How to use async values when configuring providers? #2394
-
When I set up my providers, I need to pull some secrets from Google Cloud's Secret Manager. This is an async operation and it is giving me quite a headache trying to solve. export default NextAuth({
providers: [
Providers.IdentityServer4({
id: "identity-server", //...
clientSecret: await GetSecret(), //...
})
], Obviously that won't work. I also tried something like const secret = (async () => await GetSecret())();
export default NextAuth({
providers: [
Providers.IdentityServer4({
id: "identity-server", //...
clientSecret: secret, //...
})
], but that still isn't working, though it compiles and is valid code. I cannot store this in a .env or app.yaml file, because I'd need to be able to check these files in while still keeping secrets secure. Thank you for your help! |
Beta Was this translation helpful? Give feedback.
Answered by
balazsorban44
Jul 17, 2021
Replies: 1 comment 3 replies
-
This should work: // /pages/api/auth/[...nextauth].js
export default async function handler(req, res) {
NextAuth(req, res, {
providers: [
Providers.IdentityServer4({
id: "identity-server", //...
clientSecret: await GetSecret(),
})
]
})
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
balazsorban44
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should work: