Skip to content

Commit

Permalink
fix oauth redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtsam committed Jan 15, 2025
1 parent 330dc6f commit c1da2b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/utils/auth/providers/discord.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { cachified, longLivedCache } from '#app/utils/cache.server.ts'
import { env } from '#app/utils/env.server.ts'
import { type ServerTiming } from '#app/utils/timings.server.ts'
import { type AuthProvider } from './model.ts'
import { getDomainUrl } from '#app/utils/request.server.ts'

Check warning on line 7 in app/utils/auth/providers/discord.server.ts

View workflow job for this annotation

GitHub Actions / 🧶 ESLint

`#app/utils/request.server.ts` import should occur before import of `#app/utils/timings.server.ts`

const getEmail = (profile: Profile) =>
profile.verified && profile.email ? profile.email : undefined
Expand Down Expand Up @@ -46,7 +47,7 @@ export class DiscordProvider implements AuthProvider {
{
clientId: env.DISCORD_CLIENT_ID,
clientSecret: env.DISCORD_CLIENT_SECRET,
redirectURI: new URL('/auth/discord/callback', request.url),
redirectURI: new URL('/auth/discord/callback', getDomainUrl(request)),
scopes: ['identify', 'email'],
},
async ({ tokens }) => {
Expand Down
3 changes: 2 additions & 1 deletion app/utils/auth/providers/github.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { cachified, longLivedCache } from '#app/utils/cache.server.ts'
import { env } from '#app/utils/env.server.ts'
import { type ServerTiming } from '#app/utils/timings.server.ts'
import { type AuthProvider } from './model.ts'
import { getDomainUrl } from '#app/utils/request.server.ts'

Check warning on line 7 in app/utils/auth/providers/github.server.ts

View workflow job for this annotation

GitHub Actions / 🧶 ESLint

`#app/utils/request.server.ts` import should occur before import of `#app/utils/timings.server.ts`

const getDisplayName = (profile: Profile) => profile.login
const getProfileLink = (profile: Profile) =>
Expand Down Expand Up @@ -74,7 +75,7 @@ export class GitHubProvider implements AuthProvider {
{
clientId: env.GITHUB_CLIENT_ID,
clientSecret: env.GITHUB_CLIENT_SECRET,
redirectURI: new URL('/auth/github/callback', request.url),
redirectURI: new URL('/auth/github/callback', getDomainUrl(request)),
scopes: ['user'],
},
async ({ tokens }) => {
Expand Down

0 comments on commit c1da2b8

Please sign in to comment.