Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Sep 10, 2024
1 parent 788989e commit 0dd761d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion playground/server/routes/auth/vk.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ export default oauthVKEventHandler({
return sendRedirect(event, '/')
},
})

11 changes: 5 additions & 6 deletions src/runtime/server/lib/oauth/vk.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import crypto from 'node:crypto'
import type { H3Event } from 'h3'
import { eventHandler, getQuery, sendRedirect } from 'h3'
import { withQuery } from 'ufo'
import { defu } from 'defu'
import crypto from 'node:crypto'
import {
handleMissingConfiguration,
handleAccessTokenErrorResponse,
getOAuthRedirectURL,
requestAccessToken,
type RequestAccessTokenBody
type RequestAccessTokenBody,
} from '../utils'
import { useRuntimeConfig, createError } from '#imports'
import type { OAuthConfig } from '#auth-utils'


export interface OAuthVKConfig {
/**
* VK OAuth Client ID
Expand Down Expand Up @@ -125,23 +124,23 @@ export function oauthVKEventHandler({
client_id: config.clientId,
device_id: query.device_id,
redirect_uri: redirectURL,
} as VKRequestAccessTokenBody
} as VKRequestAccessTokenBody,
})

if (tokens.error) {
return handleAccessTokenErrorResponse(event, 'vk', tokens, onError)
}

const accessToken = tokens.access_token

// TODO: improve typing
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const user: any = await $fetch(config.userURL as string, {
method: 'POST',
body: {
access_token: accessToken,
client_id: config.clientId,
}
},
})

if (!user) {
Expand Down

0 comments on commit 0dd761d

Please sign in to comment.