|
| 1 | +import type { OAuthProvider, OAuthProviderData, OAuthStrategy } from '@clerk/types'; |
| 2 | + |
| 3 | +export const OAUTH_PROVIDERS: OAuthProviderData[] = [ |
| 4 | + { |
| 5 | + provider: 'google', |
| 6 | + strategy: 'oauth_google', |
| 7 | + name: 'Google', |
| 8 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/google', |
| 9 | + }, |
| 10 | + { |
| 11 | + provider: 'discord', |
| 12 | + strategy: 'oauth_discord', |
| 13 | + name: 'Discord', |
| 14 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/discord', |
| 15 | + }, |
| 16 | + { |
| 17 | + provider: 'facebook', |
| 18 | + strategy: 'oauth_facebook', |
| 19 | + name: 'Facebook', |
| 20 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/facebook', |
| 21 | + }, |
| 22 | + { |
| 23 | + provider: 'twitch', |
| 24 | + strategy: 'oauth_twitch', |
| 25 | + name: 'Twitch', |
| 26 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/twitch', |
| 27 | + }, |
| 28 | + { |
| 29 | + provider: 'twitter', |
| 30 | + strategy: 'oauth_twitter', |
| 31 | + name: 'Twitter', |
| 32 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/twitter', |
| 33 | + }, |
| 34 | + { |
| 35 | + provider: 'microsoft', |
| 36 | + strategy: 'oauth_microsoft', |
| 37 | + name: 'Microsoft', |
| 38 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/microsoft', |
| 39 | + }, |
| 40 | + { |
| 41 | + provider: 'tiktok', |
| 42 | + strategy: 'oauth_tiktok', |
| 43 | + name: 'TikTok', |
| 44 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/tiktok', |
| 45 | + }, |
| 46 | + { |
| 47 | + provider: 'linkedin', |
| 48 | + strategy: 'oauth_linkedin', |
| 49 | + name: 'LinkedIn', |
| 50 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/linkedin', |
| 51 | + }, |
| 52 | + { |
| 53 | + provider: 'linkedin_oidc', |
| 54 | + strategy: 'oauth_linkedin_oidc', |
| 55 | + name: 'LinkedIn', |
| 56 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/linkedin-oidc', |
| 57 | + }, |
| 58 | + { |
| 59 | + provider: 'github', |
| 60 | + strategy: 'oauth_github', |
| 61 | + name: 'GitHub', |
| 62 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/github', |
| 63 | + }, |
| 64 | + { |
| 65 | + provider: 'gitlab', |
| 66 | + strategy: 'oauth_gitlab', |
| 67 | + name: 'GitLab', |
| 68 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/gitlab', |
| 69 | + }, |
| 70 | + { |
| 71 | + provider: 'dropbox', |
| 72 | + strategy: 'oauth_dropbox', |
| 73 | + name: 'Dropbox', |
| 74 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/dropbox', |
| 75 | + }, |
| 76 | + { |
| 77 | + provider: 'atlassian', |
| 78 | + strategy: 'oauth_atlassian', |
| 79 | + name: 'Atlassian', |
| 80 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/atlassian', |
| 81 | + }, |
| 82 | + { |
| 83 | + provider: 'bitbucket', |
| 84 | + strategy: 'oauth_bitbucket', |
| 85 | + name: 'Bitbucket', |
| 86 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/bitbucket', |
| 87 | + }, |
| 88 | + { |
| 89 | + provider: 'hubspot', |
| 90 | + strategy: 'oauth_hubspot', |
| 91 | + name: 'HubSpot', |
| 92 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/hubspot', |
| 93 | + }, |
| 94 | + { |
| 95 | + provider: 'notion', |
| 96 | + strategy: 'oauth_notion', |
| 97 | + name: 'Notion', |
| 98 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/notion', |
| 99 | + }, |
| 100 | + { |
| 101 | + provider: 'apple', |
| 102 | + strategy: 'oauth_apple', |
| 103 | + name: 'Apple', |
| 104 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/apple', |
| 105 | + }, |
| 106 | + { |
| 107 | + provider: 'line', |
| 108 | + strategy: 'oauth_line', |
| 109 | + name: 'LINE', |
| 110 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/line', |
| 111 | + }, |
| 112 | + { |
| 113 | + provider: 'instagram', |
| 114 | + strategy: 'oauth_instagram', |
| 115 | + name: 'Instagram', |
| 116 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/instagram', |
| 117 | + }, |
| 118 | + { |
| 119 | + provider: 'coinbase', |
| 120 | + strategy: 'oauth_coinbase', |
| 121 | + name: 'Coinbase', |
| 122 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/coinbase', |
| 123 | + }, |
| 124 | + { |
| 125 | + provider: 'spotify', |
| 126 | + strategy: 'oauth_spotify', |
| 127 | + name: 'Spotify', |
| 128 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/spotify', |
| 129 | + }, |
| 130 | + { |
| 131 | + provider: 'xero', |
| 132 | + strategy: 'oauth_xero', |
| 133 | + name: 'Xero', |
| 134 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/xero', |
| 135 | + }, |
| 136 | + { |
| 137 | + provider: 'box', |
| 138 | + strategy: 'oauth_box', |
| 139 | + name: 'Box', |
| 140 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/box', |
| 141 | + }, |
| 142 | + { |
| 143 | + provider: 'slack', |
| 144 | + strategy: 'oauth_slack', |
| 145 | + name: 'Slack', |
| 146 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/slack', |
| 147 | + }, |
| 148 | + { |
| 149 | + provider: 'linear', |
| 150 | + strategy: 'oauth_linear', |
| 151 | + name: 'Linear', |
| 152 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/linear', |
| 153 | + }, |
| 154 | + { |
| 155 | + provider: 'x', |
| 156 | + strategy: 'oauth_x', |
| 157 | + name: 'X / Twitter', |
| 158 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/x-twitter-v2', |
| 159 | + }, |
| 160 | + { |
| 161 | + provider: 'enstall', |
| 162 | + strategy: 'oauth_enstall', |
| 163 | + name: 'Enstall', |
| 164 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/enstall', |
| 165 | + }, |
| 166 | + { |
| 167 | + provider: 'huggingface', |
| 168 | + strategy: 'oauth_huggingface', |
| 169 | + name: 'Hugging Face', |
| 170 | + docsUrl: 'https://clerk.com/docs/authentication/social-connections/huggingface', |
| 171 | + }, |
| 172 | +]; |
| 173 | + |
| 174 | +interface getOAuthProviderDataProps { |
| 175 | + provider?: OAuthProvider; |
| 176 | + strategy?: OAuthStrategy; |
| 177 | +} |
| 178 | + |
| 179 | +export function getOAuthProviderData({ |
| 180 | + provider, |
| 181 | + strategy, |
| 182 | +}: getOAuthProviderDataProps): OAuthProviderData | undefined | null { |
| 183 | + if (provider) { |
| 184 | + return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.provider == provider); |
| 185 | + } |
| 186 | + |
| 187 | + return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.strategy == strategy); |
| 188 | +} |
0 commit comments