diff --git a/apps/dokploy/pages/api/providers/gitlab/callback.ts b/apps/dokploy/pages/api/providers/gitlab/callback.ts index 42d81df12..a43e88890 100644 --- a/apps/dokploy/pages/api/providers/gitlab/callback.ts +++ b/apps/dokploy/pages/api/providers/gitlab/callback.ts @@ -53,7 +53,9 @@ export default async function handler( return res.status(400).json({ error: "Missing or invalid code" }); } - const expiresAt = Math.floor(Date.now() / 1000) + result.expires_in; + const expiresAt = result.expires_in + ? Math.floor(Date.now() / 1000) + result.expires_in + : null; await updateGitlab(gitlab.gitlabId, { accessToken: result.access_token, refreshToken: result.refresh_token, diff --git a/packages/server/src/utils/providers/gitlab.ts b/packages/server/src/utils/providers/gitlab.ts index 3907130ee..6cb777b75 100644 --- a/packages/server/src/utils/providers/gitlab.ts +++ b/packages/server/src/utils/providers/gitlab.ts @@ -44,7 +44,9 @@ export const refreshGitlabToken = async (gitlabProviderId: string) => { const data = await response.json(); - const expiresAt = Math.floor(Date.now() / 1000) + data.expires_in; + const expiresAt = data.expires_in + ? Math.floor(Date.now() / 1000) + data.expires_in + : null; await updateGitlab(gitlabProviderId, { accessToken: data.access_token,