fix: usage of API_URL
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { Static, Type } from '@sinclair/typebox'
|
||||
import { FastifyPluginAsync, FastifySchema } from 'fastify'
|
||||
|
||||
import { HOST, PORT } from '../../../../../tools/configurations/index.js'
|
||||
import { API_URL } from '../../../../../tools/configurations/index.js'
|
||||
import { fastifyErrors } from '../../../../../models/utils.js'
|
||||
import { githubStrategy, getGitHubUserData } from '../__utils__/utils.js'
|
||||
import { buildQueryURL } from '../../../../../tools/utils/buildQueryURL.js'
|
||||
@ -37,7 +37,7 @@ export const getCallbackGitHubOAuth2Service: FastifyPluginAsync = async (
|
||||
const { redirectURI, code } = request.query
|
||||
const githubUser = await getGitHubUserData(
|
||||
code,
|
||||
`${request.protocol}://${HOST}:${PORT}/users/oauth2/github/callback?redirectURI=${redirectURI}`
|
||||
`${API_URL}/users/oauth2/github/callback?redirectURI=${redirectURI}`
|
||||
)
|
||||
const responseJWT = await githubStrategy.callbackSignin({
|
||||
name: githubUser.name,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Static, Type } from '@sinclair/typebox'
|
||||
import { FastifyPluginAsync, FastifySchema } from 'fastify'
|
||||
|
||||
import { HOST, PORT } from '../../../../../tools/configurations/index.js'
|
||||
import { API_URL } from '../../../../../tools/configurations/index.js'
|
||||
import { fastifyErrors } from '../../../../../models/utils.js'
|
||||
import { GITHUB_BASE_URL, GITHUB_CLIENT_ID } from '../__utils__/utils.js'
|
||||
|
||||
@ -33,7 +33,7 @@ export const getSigninGitHubOAuth2Service: FastifyPluginAsync = async (
|
||||
schema: getServiceSchema,
|
||||
handler: async (request, reply) => {
|
||||
const { redirectURI } = request.query
|
||||
const redirectCallback = `${request.protocol}://${HOST}:${PORT}/users/oauth2/github/callback?redirectURI=${redirectURI}`
|
||||
const redirectCallback = `${API_URL}/users/oauth2/github/callback?redirectURI=${redirectURI}`
|
||||
const url = `${GITHUB_BASE_URL}/login/oauth/authorize?client_id=${GITHUB_CLIENT_ID}&redirect_uri=${redirectCallback}`
|
||||
reply.statusCode = 200
|
||||
return url
|
||||
|
Reference in New Issue
Block a user