Skip to content

Commit

Permalink
fix(env): handle provider id's with - durinv env inference
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Apr 6, 2024
1 parent 0513275 commit 4dfc8af
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/core/src/lib/utils/env.ts
Expand Up @@ -38,7 +38,7 @@ export function setEnvDefaults(envObject: any, config: AuthConfig) {
)
config.providers = config.providers.map((p) => {
const finalProvider = typeof p === "function" ? p({}) : p
const ID = finalProvider.id.toUpperCase()
const ID = finalProvider.id.toUpperCase().replace(/-/g, "_")
if (finalProvider.type === "oauth" || finalProvider.type === "oidc") {
finalProvider.clientId ??= envObject[`AUTH_${ID}_ID`]
finalProvider.clientSecret ??= envObject[`AUTH_${ID}_SECRET`]
Expand Down Expand Up @@ -76,8 +76,10 @@ export function createActionURL(
const detectedHost = headers.get("x-forwarded-host") ?? headers.get("host")
const detectedProtocol =
headers.get("x-forwarded-proto") ?? protocol ?? "https"
const _protocol = detectedProtocol.endsWith(":") ? detectedProtocol : detectedProtocol + ':'

const _protocol = detectedProtocol.endsWith(":")
? detectedProtocol
: detectedProtocol + ":"

url = new URL(`${_protocol}//${detectedHost}`)
}

Expand Down

0 comments on commit 4dfc8af

Please sign in to comment.