mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-24 17:05:42 +00:00
UBERF-10653: Handle gmail integration errors (#8985)
This commit is contained in:
parent
9035cc24a1
commit
a4cc6e102e
@ -153,6 +153,9 @@
|
|||||||
"EnablePermissions": "Povolit řízení přístupu na základě rolí",
|
"EnablePermissions": "Povolit řízení přístupu na základě rolí",
|
||||||
"DisablePermissionsConfirmation": "Opravdu chcete zakázat řízení přístupu na základě rolí? Všechny role a oprávnění budou deaktivovány.",
|
"DisablePermissionsConfirmation": "Opravdu chcete zakázat řízení přístupu na základě rolí? Všechny role a oprávnění budou deaktivovány.",
|
||||||
"EnablePermissionsConfirmation": "Opravdu chcete povolit řízení přístupu na základě rolí? Všechny role a oprávnění budou aktivovány.",
|
"EnablePermissionsConfirmation": "Opravdu chcete povolit řízení přístupu na základě rolí? Všechny role a oprávnění budou aktivovány.",
|
||||||
"BetaWarning": "Moduly označené jako beta jsou k dispozici pro experimentální účely a nemusí být plně funkční. V tuto chvíli nedoporučujeme spoléhat se na funkce beta pro kritickou práci."
|
"BetaWarning": "Moduly označené jako beta jsou k dispozici pro experimentální účely a nemusí být plně funkční. V tuto chvíli nedoporučujeme spoléhat se na funkce beta pro kritickou práci.",
|
||||||
|
"IntegrationFailed": "Nepodařilo se vytvořit integraci",
|
||||||
|
"IntegrationError": "Zkuste to prosím znovu nebo kontaktujte podporu, pokud problém přetrvává",
|
||||||
|
"EmailIsUsed": "E-mailová adresa je již použita jiným účtem"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,9 @@
|
|||||||
"EnablePermissions": "Rollenbasierte Zugriffskontrolle aktivieren",
|
"EnablePermissions": "Rollenbasierte Zugriffskontrolle aktivieren",
|
||||||
"DisablePermissionsConfirmation": "Sind Sie sicher, dass Sie die rollenbasierte Zugriffskontrolle deaktivieren möchten? Alle Rollen und Berechtigungen werden deaktiviert.",
|
"DisablePermissionsConfirmation": "Sind Sie sicher, dass Sie die rollenbasierte Zugriffskontrolle deaktivieren möchten? Alle Rollen und Berechtigungen werden deaktiviert.",
|
||||||
"EnablePermissionsConfirmation": "Sind Sie sicher, dass Sie die rollenbasierte Zugriffskontrolle aktivieren möchten? Alle Rollen und Berechtigungen werden aktiviert.",
|
"EnablePermissionsConfirmation": "Sind Sie sicher, dass Sie die rollenbasierte Zugriffskontrolle aktivieren möchten? Alle Rollen und Berechtigungen werden aktiviert.",
|
||||||
"BetaWarningDe": "Als Beta gekennzeichnete Module sind zu experimentellen Zwecken verfügbar und funktionieren möglicherweise nicht vollständig. Wir empfehlen derzeit nicht, sich auf Beta-Funktionen für kritische Arbeiten zu verlassen."
|
"BetaWarningDe": "Als Beta gekennzeichnete Module sind zu experimentellen Zwecken verfügbar und funktionieren möglicherweise nicht vollständig. Wir empfehlen derzeit nicht, sich auf Beta-Funktionen für kritische Arbeiten zu verlassen.",
|
||||||
|
"IntegrationFailed": "Integration konnte nicht erstellt werden",
|
||||||
|
"IntegrationError": "Bitte versuchen Sie es erneut oder wenden Sie sich an den Support, wenn das Problem weiterhin besteht",
|
||||||
|
"EmailIsUsed": "E-Mail-Adresse wird in einem anderen Konto verwendet"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,5 +153,9 @@
|
|||||||
"EnablePermissions": "Enable role-based access control",
|
"EnablePermissions": "Enable role-based access control",
|
||||||
"DisablePermissionsConfirmation": "Are you sure you want to disable role-based access control? All roles and permissions will be disabled.",
|
"DisablePermissionsConfirmation": "Are you sure you want to disable role-based access control? All roles and permissions will be disabled.",
|
||||||
"EnablePermissionsConfirmation": "Are you sure you want to enable role-based access control? All roles and permissions will be enabled.",
|
"EnablePermissionsConfirmation": "Are you sure you want to enable role-based access control? All roles and permissions will be enabled.",
|
||||||
"BetaWarning": "Modules labeled as beta are available for experimental purposes and may not be fully functional. We do not recommend relying on beta features for critical work at this time." }
|
"BetaWarning": "Modules labeled as beta are available for experimental purposes and may not be fully functional. We do not recommend relying on beta features for critical work at this time.",
|
||||||
|
"IntegrationFailed": "Failed to create integration",
|
||||||
|
"IntegrationError": "Please try again or contact support if the problem persists",
|
||||||
|
"EmailIsUsed": "Email address is already used by another account"
|
||||||
|
}
|
||||||
}
|
}
|
@ -144,6 +144,9 @@
|
|||||||
"EnablePermissions": "Activar el control de acceso basado en roles",
|
"EnablePermissions": "Activar el control de acceso basado en roles",
|
||||||
"DisablePermissionsConfirmation": "¿Está seguro de que desea desactivar el control de acceso basado en roles? Todos los roles y permisos serán desactivados.",
|
"DisablePermissionsConfirmation": "¿Está seguro de que desea desactivar el control de acceso basado en roles? Todos los roles y permisos serán desactivados.",
|
||||||
"EnablePermissionsConfirmation": "¿Está seguro de que desea activar el control de acceso basado en roles? Todos los roles y permisos serán activados.",
|
"EnablePermissionsConfirmation": "¿Está seguro de que desea activar el control de acceso basado en roles? Todos los roles y permisos serán activados.",
|
||||||
"BetaWarning": "Los módulos etiquetados como beta están disponibles con fines experimentales y pueden no ser completamente funcionales. No recomendamos confiar en las funciones beta para trabajos críticos en este momento."
|
"BetaWarning": "Los módulos etiquetados como beta están disponibles con fines experimentales y pueden no ser completamente funcionales. No recomendamos confiar en las funciones beta para trabajos críticos en este momento.",
|
||||||
|
"IntegrationFailed": "Error al crear la integración",
|
||||||
|
"IntegrationError": "Por favor, inténtelo de nuevo o contacte con soporte si el problema persiste",
|
||||||
|
"EmailIsUsed": "El correo electrónico ya está en uso"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,9 @@
|
|||||||
"EnablePermissions": "Activer le contrôle d'accès basé sur les rôles",
|
"EnablePermissions": "Activer le contrôle d'accès basé sur les rôles",
|
||||||
"DisablePermissionsConfirmation": "Êtes-vous sûr de vouloir désactiver le contrôle d'accès basé sur les rôles ? Tous les rôles et permissions seront désactivés.",
|
"DisablePermissionsConfirmation": "Êtes-vous sûr de vouloir désactiver le contrôle d'accès basé sur les rôles ? Tous les rôles et permissions seront désactivés.",
|
||||||
"EnablePermissionsConfirmation": "Êtes-vous sûr de vouloir activer le contrôle d'accès basé sur les rôles ? Tous les rôles et permissions seront activés.",
|
"EnablePermissionsConfirmation": "Êtes-vous sûr de vouloir activer le contrôle d'accès basé sur les rôles ? Tous les rôles et permissions seront activés.",
|
||||||
"BetaWarning": "Les modules étiquetés comme bêta sont disponibles à des fins expérimentales et peuvent ne pas être entièrement fonctionnels. Nous ne recommandons pas de compter sur les fonctionnalités bêta pour un travail critique pour le moment."
|
"BetaWarning": "Les modules étiquetés comme bêta sont disponibles à des fins expérimentales et peuvent ne pas être entièrement fonctionnels. Nous ne recommandons pas de compter sur les fonctionnalités bêta pour un travail critique pour le moment.",
|
||||||
|
"IntegrationFailed": "Échec de la création de l'intégration",
|
||||||
|
"IntegrationError": "Veuillez réessayer ou contacter le support si le problème persiste",
|
||||||
|
"EmailIsUsed": "L'adresse e-mail est déjà utilisée par un autre compte"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,9 @@
|
|||||||
"EnablePermissions": "Abilita il controllo degli accessi basato sui ruoli",
|
"EnablePermissions": "Abilita il controllo degli accessi basato sui ruoli",
|
||||||
"DisablePermissionsConfirmation": "Sei sicuro di voler disabilitare il controllo degli accessi basato sui ruoli? Tutti i ruoli e le autorizzazioni verranno disabilitati.",
|
"DisablePermissionsConfirmation": "Sei sicuro di voler disabilitare il controllo degli accessi basato sui ruoli? Tutti i ruoli e le autorizzazioni verranno disabilitati.",
|
||||||
"EnablePermissionsConfirmation": "Sei sicuro di voler abilitare il controllo degli accessi basato sui ruoli? Tutti i ruoli e le autorizzazioni verranno abilitati.",
|
"EnablePermissionsConfirmation": "Sei sicuro di voler abilitare il controllo degli accessi basato sui ruoli? Tutti i ruoli e le autorizzazioni verranno abilitati.",
|
||||||
"BetaWarning": "I moduli contrassegnati come beta sono disponibili per scopi sperimentali e potrebbero non funzionare completamente. Non ti consigliamo di fare affidamento sulle funzionalità beta per il lavoro critico in questo momento."
|
"BetaWarning": "I moduli contrassegnati come beta sono disponibili per scopi sperimentali e potrebbero non funzionare completamente. Non ti consigliamo di fare affidamento sulle funzionalità beta per il lavoro critico in questo momento.",
|
||||||
|
"IntegrationFailed": "Impossibile creare l'integrazione",
|
||||||
|
"IntegrationError": "Si prega di riprovare o contattare il supporto se il problema persiste",
|
||||||
|
"EmailIsUsed": "L'email è già in uso"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,9 @@
|
|||||||
"EnablePermissions": "ロールベースのアクセス制御を有効にする",
|
"EnablePermissions": "ロールベースのアクセス制御を有効にする",
|
||||||
"DisablePermissionsConfirmation": "本当にロールベースのアクセス制御を無効にしますか?すべての役割と権限が無効になります。",
|
"DisablePermissionsConfirmation": "本当にロールベースのアクセス制御を無効にしますか?すべての役割と権限が無効になります。",
|
||||||
"EnablePermissionsConfirmation": "本当にロールベースのアクセス制御を有効にしますか?すべての役割と権限が有効になります。",
|
"EnablePermissionsConfirmation": "本当にロールベースのアクセス制御を有効にしますか?すべての役割と権限が有効になります。",
|
||||||
"BetaWarning": "ベータ版としてラベル付けされたモジュールは、実験的な目的で利用可能であり、完全に機能しない場合があります。現時点では、重要な作業にベータ版機能を依存することはお勧めしません。"
|
"BetaWarning": "ベータ版としてラベル付けされたモジュールは、実験的な目的で利用可能であり、完全に機能しない場合があります。現時点では、重要な作業にベータ版機能を依存することはお勧めしません。",
|
||||||
|
"IntegrationFailed": "統合に失敗しました",
|
||||||
|
"IntegrationError": "問題が解決しない場合は、もう一度お試しいただくか、サポートにお問い合わせください",
|
||||||
|
"EmailIsUsed": "メールアドレスは他のアカウントで使用されています"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,9 @@
|
|||||||
"EnablePermissions": "Ativar controle de acesso baseado em funções",
|
"EnablePermissions": "Ativar controle de acesso baseado em funções",
|
||||||
"DisablePermissionsConfirmation": "Tem certeza de que deseja desativar o controle de acesso baseado em funções? Todos os papéis e permissões serão desativados.",
|
"DisablePermissionsConfirmation": "Tem certeza de que deseja desativar o controle de acesso baseado em funções? Todos os papéis e permissões serão desativados.",
|
||||||
"EnablePermissionsConfirmation": "Tem certeza de que deseja ativar o controle de acesso baseado em funções? Todos os papéis e permissões serão ativados.",
|
"EnablePermissionsConfirmation": "Tem certeza de que deseja ativar o controle de acesso baseado em funções? Todos os papéis e permissões serão ativados.",
|
||||||
"BetaWarning": "Modules labeled as beta are available for experimental purposes and may not be fully functional. We do not recommend relying on beta features for critical work at this time."
|
"BetaWarning": "Modules labeled as beta are available for experimental purposes and may not be fully functional. We do not recommend relying on beta features for critical work at this time.",
|
||||||
|
"IntegrationFailed": "Falha na integração",
|
||||||
|
"IntegrationError": "Tente novamente ou entre em contato com o suporte se o problema persistir",
|
||||||
|
"EmailIsUsed": "Este e-mail já está em uso"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,9 @@
|
|||||||
"EnablePermissions": "Включить ролевое управление доступом",
|
"EnablePermissions": "Включить ролевое управление доступом",
|
||||||
"DisablePermissionsConfirmation": "Вы уверены, что хотите отключить ролевое управление доступом? Все роли и разрешения будут отключены.",
|
"DisablePermissionsConfirmation": "Вы уверены, что хотите отключить ролевое управление доступом? Все роли и разрешения будут отключены.",
|
||||||
"EnablePermissionsConfirmation": "Вы уверены, что хотите включить ролевое управление доступом? Все роли и разрешения будут включены.",
|
"EnablePermissionsConfirmation": "Вы уверены, что хотите включить ролевое управление доступом? Все роли и разрешения будут включены.",
|
||||||
"BetaWarning": "Модули, помеченные как бета-версии, доступны для экспериментальных целей и могут быть не полностью функциональными. Мы не рекомендуем полагаться на функции бета-версии для критической работы в настоящее время."
|
"BetaWarning": "Модули, помеченные как бета-версии, доступны для экспериментальных целей и могут быть не полностью функциональными. Мы не рекомендуем полагаться на функции бета-версии для критической работы в настоящее время.",
|
||||||
|
"IntegrationFailed": "Не удалось создать интеграцию",
|
||||||
|
"IntegrationError": "Пожалуйста, попробуйте снова или свяжитесь с поддержкой, если проблема не исчезнет",
|
||||||
|
"EmailIsUsed": "Адрес электронной почты уже используется другим аккаунтом"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,9 @@
|
|||||||
"EnablePermissions": "启用基于角色的访问控制",
|
"EnablePermissions": "启用基于角色的访问控制",
|
||||||
"DisablePermissionsConfirmation": "您确定要禁用基于角色的访问控制吗?所有角色和权限都将被禁用。",
|
"DisablePermissionsConfirmation": "您确定要禁用基于角色的访问控制吗?所有角色和权限都将被禁用。",
|
||||||
"EnablePermissionsConfirmation": "您确定要启用基于角色的访问控制吗?所有角色和权限都将被启用。",
|
"EnablePermissionsConfirmation": "您确定要启用基于角色的访问控制吗?所有角色和权限都将被启用。",
|
||||||
"BetaWarning": "标记为测试版的模块可用于实验目的,可能无法完全正常工作。我们不建议在此时依赖测试版功能进行关键工作。"
|
"BetaWarning": "标记为测试版的模块可用于实验目的,可能无法完全正常工作。我们不建议在此时依赖测试版功能进行关键工作。",
|
||||||
|
"IntegrationFailed": "创建集成失败",
|
||||||
|
"IntegrationError": "请重试,如果问题仍然存在,请联系客服支持",
|
||||||
|
"EmailIsUsed": "该电子邮件地址已被其他账户使用"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
<!--
|
||||||
|
//
|
||||||
|
// Copyright © 2025 Hardcore Engineering Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License. You may
|
||||||
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Notification, NotificationToast } from '@hcengineering/ui'
|
||||||
|
|
||||||
|
export let notification: Notification
|
||||||
|
export let onRemove: () => void
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<NotificationToast title={notification.title} severity={notification.severity} onClose={onRemove}>
|
||||||
|
<svelte:fragment slot="content">
|
||||||
|
{notification.subTitle}
|
||||||
|
</svelte:fragment>
|
||||||
|
</NotificationToast>
|
@ -13,12 +13,16 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { onMount } from 'svelte'
|
||||||
import { Ref, getCurrentAccount } from '@hcengineering/core'
|
import { Ref, getCurrentAccount } from '@hcengineering/core'
|
||||||
import { createQuery } from '@hcengineering/presentation'
|
import { createQuery } from '@hcengineering/presentation'
|
||||||
import type { Integration, IntegrationType } from '@hcengineering/setting'
|
import { type Integration, type IntegrationType, IntegrationError } from '@hcengineering/setting'
|
||||||
import setting from '@hcengineering/setting'
|
import setting from '@hcengineering/setting'
|
||||||
import { Header, Breadcrumb } from '@hcengineering/ui'
|
|
||||||
|
import { Header, Breadcrumb, NotificationSeverity, addNotification, themeStore } from '@hcengineering/ui'
|
||||||
|
import { translate } from '@hcengineering/platform'
|
||||||
import PluginCard from './PluginCard.svelte'
|
import PluginCard from './PluginCard.svelte'
|
||||||
|
import IntegrationErrorNotification from './IntegrationErrorNotification.svelte'
|
||||||
|
|
||||||
const typeQuery = createQuery()
|
const typeQuery = createQuery()
|
||||||
const integrationQuery = createQuery()
|
const integrationQuery = createQuery()
|
||||||
@ -36,6 +40,38 @@
|
|||||||
function getIntegrations (type: Ref<IntegrationType>, integrations: Integration[]): Integration[] {
|
function getIntegrations (type: Ref<IntegrationType>, integrations: Integration[]): Integration[] {
|
||||||
return integrations.filter((p) => p.type === type)
|
return integrations.filter((p) => p.type === type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
// Check URL parameters for error message
|
||||||
|
const urlParams = new URLSearchParams(window.location.search)
|
||||||
|
const error = urlParams.get('integrationError')
|
||||||
|
|
||||||
|
if (error != null) {
|
||||||
|
const decodedError = decodeURIComponent(error)
|
||||||
|
console.error('Integration error:', decodedError)
|
||||||
|
await showErrorNotification(decodedError)
|
||||||
|
// Clean up integrationError parameter from the URL
|
||||||
|
urlParams.delete('integrationError')
|
||||||
|
const newParams = urlParams.toString()
|
||||||
|
const newUrl =
|
||||||
|
window.location.pathname + (newParams != null && newParams !== '' ? `?${newParams}` : '') + window.location.hash
|
||||||
|
window.history.replaceState({}, document.title, newUrl)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
async function showErrorNotification (error: string): Promise<void> {
|
||||||
|
const errorMessage =
|
||||||
|
error === IntegrationError.EMAIL_IS_ALREADY_USED
|
||||||
|
? await translate(setting.string.EmailIsUsed, {}, $themeStore.language)
|
||||||
|
: await translate(setting.string.IntegrationError, {}, $themeStore.language)
|
||||||
|
addNotification(
|
||||||
|
await translate(setting.string.IntegrationFailed, {}, $themeStore.language),
|
||||||
|
errorMessage,
|
||||||
|
IntegrationErrorNotification,
|
||||||
|
undefined,
|
||||||
|
NotificationSeverity.Error
|
||||||
|
)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="hulyComponent">
|
<div class="hulyComponent">
|
||||||
|
@ -111,6 +111,10 @@ export interface WorkspaceSetting extends Doc {
|
|||||||
icon?: Ref<Blob> | null
|
icon?: Ref<Blob> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum IntegrationError {
|
||||||
|
EMAIL_IS_ALREADY_USED = 'EMAIL_IS_ALREADY_USED'
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
@ -239,7 +243,10 @@ export default plugin(settingId, {
|
|||||||
MailboxErrorMailboxExists: '' as IntlString,
|
MailboxErrorMailboxExists: '' as IntlString,
|
||||||
MailboxErrorMailboxCountLimit: '' as IntlString,
|
MailboxErrorMailboxCountLimit: '' as IntlString,
|
||||||
DeleteMailbox: '' as IntlString,
|
DeleteMailbox: '' as IntlString,
|
||||||
MailboxDeleteConfirmation: '' as IntlString
|
MailboxDeleteConfirmation: '' as IntlString,
|
||||||
|
IntegrationFailed: '' as IntlString,
|
||||||
|
IntegrationError: '' as IntlString,
|
||||||
|
EmailIsUsed: '' as IntlString
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
AccountSettings: '' as Asset,
|
AccountSettings: '' as Asset,
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import { AccountUuid, Person, PersonId, SocialId, SocialIdType, buildSocialIdString } from '@hcengineering/core'
|
import { AccountUuid, Person, PersonId, SocialId, SocialIdType, buildSocialIdString } from '@hcengineering/core'
|
||||||
import { getAccountClient } from '@hcengineering/server-client'
|
import { getAccountClient } from '@hcengineering/server-client'
|
||||||
import { generateToken } from '@hcengineering/server-token'
|
import { generateToken } from '@hcengineering/server-token'
|
||||||
|
import { IntegrationError } from '@hcengineering/setting'
|
||||||
|
|
||||||
import { serviceToken } from './utils'
|
import { serviceToken } from './utils'
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ export async function getOrCreateSocialId (account: AccountUuid, email: string):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (socialId.personUuid !== account) {
|
if (socialId.personUuid !== account) {
|
||||||
throw new Error('Social id connected to another account')
|
throw new Error(IntegrationError.EMAIL_IS_ALREADY_USED)
|
||||||
}
|
}
|
||||||
|
|
||||||
return socialId
|
return socialId
|
||||||
|
@ -101,17 +101,25 @@ export const main = async (): Promise<void> => {
|
|||||||
endpoint: '/signin/code',
|
endpoint: '/signin/code',
|
||||||
type: 'get',
|
type: 'get',
|
||||||
handler: async (req, res) => {
|
handler: async (req, res) => {
|
||||||
|
let state: State | undefined
|
||||||
try {
|
try {
|
||||||
ctx.info('Signin code request received')
|
ctx.info('Signin code request received')
|
||||||
const code = req.query.code as string
|
const code = req.query.code as string
|
||||||
const state = JSON.parse(decode64(req.query.state as string)) as unknown as State
|
state = JSON.parse(decode64(req.query.state as string)) as unknown as State
|
||||||
await gmailController.createClient(state, code)
|
await gmailController.createClient(state, code)
|
||||||
res.redirect(state.redirectURL)
|
res.redirect(state.redirectURL)
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
ctx.error('Failed to process signin code', { message: (err as any).message })
|
ctx.error('Failed to process signin code', { message: err.message })
|
||||||
|
if (state !== undefined) {
|
||||||
|
const errorMessage = encodeURIComponent(err.message)
|
||||||
|
const url = new URL(state.redirectURL)
|
||||||
|
url.searchParams.append('integrationError', errorMessage)
|
||||||
|
res.redirect(url.toString())
|
||||||
|
} else {
|
||||||
res.status(500).send()
|
res.status(500).send()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
endpoint: '/signout',
|
endpoint: '/signout',
|
||||||
|
Loading…
Reference in New Issue
Block a user