작업계획서대로 진행

This commit is contained in:
2026-01-11 22:45:23 +09:00
parent da4d22e9c1
commit 4f6fe212e2
3 changed files with 24 additions and 9 deletions

5
.env
View File

@@ -22,3 +22,8 @@ SMTP_PORT=587
SMTP_USER=turbosoft11@gmail.com
SMTP_PASS="kojl sxbx pdfi yhxz"
SMTP_FROM=업무관리프로그램 <turbosoft11@gmail.com>
SYNOLOGY_SERVER_URL=https://sso.osolit.net
SYNOLOGY_CLIENT_ID=afa90b7b4a9773af41f2c7b110f92d6e
SYNOLOGY_CLIENT_SECRET=
SYNOLOGY_REDIRECT_URI=https://weeklyreport.turbosoft.kr/api/auth/synology/callback

View File

@@ -17,3 +17,9 @@ SMTP_PORT=587
SMTP_USER=turbosoft11@gmail.com
SMTP_PASS="kojl sxbx pdfi yhxz"
SMTP_FROM=업무관리프로그램 <turbosoft11@gmail.com>
SYNOLOGY_SERVER_URL=https://sso.osolit.net
SYNOLOGY_CLIENT_ID=afa90b7b4a9773af41f2c7b110f92d6e
SYNOLOGY_CLIENT_SECRET=
SYNOLOGY_REDIRECT_URI=https://weeklyreport.turbosoft.kr/api/auth/synology/callback

View File

@@ -26,16 +26,20 @@ export default defineEventHandler(async (event) => {
try {
// 1. 코드로 액세스 토큰 교환
const tokenParams = new URLSearchParams({
grant_type: 'authorization_code',
code: code,
client_id: config.synologyClientId,
redirect_uri: config.synologyRedirectUri
})
if (config.synologyClientSecret) {
tokenParams.set('client_secret', config.synologyClientSecret)
}
const tokenResponse = await $fetch<any>(`${config.synologyServerUrl}/webman/sso/SSOAccessToken.cgi`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'authorization_code',
code: code,
client_id: config.synologyClientId,
client_secret: config.synologyClientSecret,
redirect_uri: config.synologyRedirectUri
}).toString()
body: tokenParams.toString()
})
if (!tokenResponse.access_token) {