작업계획서대로 진행
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user