Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.
/ auth-env Public archive

Load auth.js providers dynamically, by detecting environment variables

Notifications You must be signed in to change notification settings

joshnuss/auth-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auth-env

Load Auth.js providers dynamically, by detecting environment variables.

Usage

Install the package:

pnpm install -D auth-env

Define env vars in your .env or in your hosting settings.

For example, for Github, define a GITHUB_ID & GITHUB_SECRET.

# in .env
GITHUB_ID=...
GITHUB_SECRET=...

SvelteKit

Import providers in src/hooks.server.js:

import { SvelteKitAuth } from "@auth/sveltekit"
import { providers } from "auth-env"

export const handle = SvelteKitAuth({ providers })

Next.js

Import providers in auth.ts:

import NextAuth from "next-auth"
import { providers } from "auth-env"

export const { handlers, auth } = NextAuth({ providers })

Supported Providers

  • 42-school: 42_SCHOOL_CLIENT_ID & 42_SCHOOL_CLIENT_SECRET
  • Apple: APPLE_ID & APPLE_SECRET
  • Asgardeo: ASGARDEO_CLIENT_ID & ASGARDEO_CLIENT_SECRET
  • Atlassian: ATLASSIAN_ID & ATLASSIAN_SECRET
  • Auth0: AUTH0_ID & AUTH0_SECRET
  • Authentik: AUTHENTIK_CLIENT_ID & AUTHENTIK_CLIENT_SECRET
  • AzureAD: AZURE_AD_CLIENT_ID & AZURE_AD_CLIENT_SECRET
  • AzureAD B2C: AZURE_AD_B2C_CLIENT_ID, AZURE_AD_B2C_CLIENT_SECRET & AZURE_AD_B2C_ISSUER
  • Azure DevOps: AZURE_DEVOPS_APP_ID, AZURE_DEVOPS_CLIENT_SECRET & AZURE_DEVOPS_SCOPE
  • BattleNet: BATTLENET_CLIENT_ID & BATTLENET_CLIENT_SECRET
  • BeyondIdentity: BEYOND_IDENTITY_CLIENT_ID, BEYOND_IDENTITY_CLIENT_SECRET & BEYOND_IDENTITY_ISSUER
  • Box: BOX_CLIENT_ID & BOX_CLIENT_SECRET
  • BoxyHQ: BOXYHQ_SAML_CLIENT_ID, BOXYHQ_SAML_CLIENT_SECRET & BOXYHQ_SAML_ISSUER
  • Bungie: BUNGIE_CLIENT_ID, BUNGIE_CLIENT_SECRET & BUNGIE_API_KEY
  • ClickUp: CLICKUP_CLIENT_ID & CLICKUP_CLIENT_SECRET
  • Cognito: COGNITO_CLIENT_ID, COGNITO_CLIENT_SECRET & COGNITO_ISSUER
  • Coinbase: COINBASE_CLIENT_ID & COINBASE_CLIENT_SECRET
  • Descope: DESCOPE_ID & DESCOPE_SECRET
  • Discord: DISCORD_CLIENT_ID & DISCORD_CLIENT_SECRET
  • Dribbble: DRIBBBLE_CLIENT_ID & DRIBBBLE_CLIENT_SECRET
  • Dropbox: DROPBOX_CLIENT_ID & DROPBOX_CLIENT_SECRET
  • DuendeIdentityServer6: DIS6_CLIENT_ID, DIS6_CLIENT_SECRET & DIS6_ISSUER
  • Email: EMAIL_SERVER & EMAIL_FROM
  • EveOnline: EVEONLINE_CLIENT_ID & EVEONLINE_CLIENT_SECRET
  • Facebook: FACEBOOK_CLIENT_ID & FACEBOOK_CLIENT_SECRET
  • FACEIT: FACEIT_CLIENT_ID & FACEIT_CLIENT_SECRET
  • FourSquare: FOURSQUARE_CLIENT_ID & FOURSQUARE_CLIENT_SECRET
  • FreshBooks: FRESHBOOKS_CLIENT_ID & FRESHBOOKS_CLIENT_SECRET
  • FusionAuth: FUSIONAUTH_CLIENT_ID, FUSIONAUTH_CLIENT_SECRET, FUSIONAUTH_TENANT_ID & FUSIONAUTH_ISSUER
  • GitHub: GITHUB_ID & GITHUB_SECRET
  • GitLab: GITLAB_CLIENT_ID & GITLAB_CLIENT_SECRET
  • Google: GOOGLE_CLIENT_ID & GOOGLE_CLIENT_SECRET
  • HubSpot: HUBSPOT_CLIENT_ID & HUBSPOT_CLIENT_SECRET
  • IdentityServer4: IDENTITY_SERVER4_CLIENT_ID, IDENTITY_SERVER4_CLIENT_SECRET & IDENTITY_SERVER4_ISSUER
  • Instagram: INSTAGRAM_CLIENT_ID & INSTAGRAM_CLIENT_SECRET
  • Kakao: KAKAO_CLIENT_ID & KAKAO_CLIENT_SECRET
  • Keycloak: KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET & KEYCLOAK_ISSUER
  • LINE: LINE_CLIENT_ID & LINE_CLIENT_SECRET
  • LinkedIn: LINKEDIN_CLIENT_ID & LINKEDIN_CLIENT_SECRET
  • Mailchimp: MAILCHIMP_CLIENT_ID & MAILCHIMP_CLIENT_SECRET
  • Mailru: MAILRU_CLIENT_ID & MAILRU_CLIENT_SECRET
  • Mastodon: MASTODON_CLIENT_ID, MASTODON_CLIENT_SECRET & MASTODON_ISSUER
  • Mattermost: MATTERMOST_CLIENT_ID, MATTERMOST_CLIENT_SECRET & MATTERMOST_ISSUER
  • Medium: MEDIUM_CLIENT_ID & MEDIUM_CLIENT_SECRET
  • Naver: NAVER_CLIENT_ID & NAVER_CLIENT_SECRET
  • Netlify: NETLIFY_CLIENT_ID & NETLIFY_CLIENT_SECRET
  • Notion: NOTION_CLIENT_ID, NOTION_CLIENT_SECRET & NOTION_CLIENT_REDIRECT_URI
  • Okta: OKTA_CLIENT_ID, OKTA_CLIENT_SECRET & OKTA_ISSUER
  • OneLogin: ONELOGIN_CLIENT_ID & ONELOGIN_CLIENT_SECRET
  • Osso: OSSO_CLIENT_ID, OSSO_CLIENT_SECRET & OSSO_ISSUER
  • Osu: OSU_CLIENT_ID & OSU_CLIENT_SECRET
  • Passage: PASSAGE_ID, PASSAGE_SECRET & PASSAGE_ISSUER
  • Patreon: PATREON_CLIENT_ID & PATREON_CLIENT_SECRET
  • Pinterest: PINTEREST_CLIENT_ID & PINTEREST_CLIENT_SECRET
  • Pipedrive: PIPEDRIVE_CLIENT_ID & PIPEDRIVE_CLIENT_SECRET
  • Reddit: REDDIT_CLIENT_ID & REDDIT_CLIENT_SECRET
  • SaleForce: SALEFORCE_CLIENT_ID & SALEFORCE_CLIENT_SECRET
  • Slack: SLACK_CLIENT_ID & SLACK_CLIENT_SECRET
  • Spotify: SPOTIFY_CLIENT_ID & SPOTIFY_CLIENT_SECRET
  • Strava: STRAVA_CLIENT_ID & STRAVA_CLIENT_SECRET
  • Tiktok: TIKTOK_CLIENT_KEY & TIKTOK_CLIENT_SECRET
  • Todoist: TODOIST_CLIENT_ID & TODOIST_CLIENT_SECRET
  • Trakt: TRAKT_CLIENT_ID & TRAKT_CLIENT_SECRET
  • Twitch: TWITCH_CLIENT_ID & TWITCH_CLIENT_SECRET
  • Twitter: TWITTER_CLIENT_ID & TWITTER_CLIENT_SECRET
  • UnitedEffects: UE_CLIENT_ID & UE_CLIENT_SECRET
  • VK: VK_CLIENT_ID & VK_CLIENT_SECRET
  • Wikimedia: WIKIMEDIA_CLIENT_ID & WIKIMEDIA_CLIENT_SECRET
  • WordPress: WORKPRESS_CLIENT_ID & WORKPRESS_CLIENT_SECRET
  • WorkOS: WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET & WORKOS_ISSUER
  • Yandex: YANDEX_CLIENT_ID & YANDEX_CLIENT_SECRET
  • ZITADEL: ZITADEL_CLIENT_ID & ZITADEL_CLIENT_SECRET
  • ZOHO: ZOHO_CLIENT_ID & ZOHO_CLIENT_SECRET
  • Zoom: ZOOM_CLIENT_ID & ZOOM_CLIENT_SECRET

The aim is to support all providers. Feel free to open a PR if anything is missing.

License

MIT

About

Load auth.js providers dynamically, by detecting environment variables

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published