providers/vk
VkProfile
https://dev.vk.com/reference/objects/user
属性
about?
optional about: string;
activities?
optional activities: string;
bdate?
optional bdate: string;
blacklisted?
optional blacklisted: 0 | 1;
blacklisted_by_me?
optional blacklisted_by_me: 0 | 1;
books?
optional books: string;
can_access_closed
can_access_closed: boolean;
can_post?
optional can_post: 0 | 1;
can_see_all_posts?
optional can_see_all_posts: 0 | 1;
can_see_audio?
optional can_see_audio: 0 | 1;
can_send_friend_request?
optional can_send_friend_request: 0 | 1;
can_write_private_message?
optional can_write_private_message: 0 | 1;
career?
optional career: {
city_id: number;
city_name: string;
company: string;
country_id: number;
from: number;
group_id: number;
position: string;
until: number;
};
city_id?
optional city_id: number;
city_name?
optional city_name: string;
company?
optional company: string;
country_id?
optional country_id: number;
from?
optional from: number;
group_id?
optional group_id: number;
position?
optional position: string;
until?
optional until: number;
city?
optional city: {
id: number;
title: string;
};
id
id: number;
title
title: string;
common_count?
optional common_count: number;
connections?
optional connections: {
facebook: string;
instagram: string;
livejournal: string;
skype: string;
twitter: string;
};
facebook?
optional facebook: string;
instagram?
optional instagram: string;
livejournal?
optional livejournal: string;
skype?
optional skype: string;
twitter?
optional twitter: string;
contacts?
optional contacts: {
home_phone: string;
mobile_phone: string;
};
home_phone?
optional home_phone: string;
mobile_phone?
optional mobile_phone: string;
counters?
optional counters: {
albums: number;
audios: number;
followers: number;
friends: number;
groups: number;
mutual_friends: number;
notes: number;
online_friends: number;
pages: number;
photos: number;
user_videos: number;
videos: number;
};
相册?
optional albums: number;
音频?
optional audios: number;
关注者?
optional followers: number;
朋友?
optional friends: number;
群组?
optional groups: number;
共同好友?
optional mutual_friends: number;
笔记?
optional notes: number;
在线好友?
optional online_friends: number;
页面?
optional pages: number;
照片?
optional photos: number;
用户视频?
optional user_videos: number;
视频?
optional videos: number;
国家?
optional country: {
id: number;
title: string;
};
ID
id: number;
标题
title: string;
裁剪照片?
optional crop_photo: {
crop: {
x: number;
x2: number;
y: number;
y2: number;
};
photo: {
access_key: string;
album_id: number;
can_comment: 0 | 1;
date: number;
has_tags: boolean;
height: number;
id: number;
images: {
height: number;
type: | "p"
| "q"
| "s"
| "r"
| "x"
| "y"
| "m"
| "l"
| "o"
| "z"
| "w";
url: string;
width: number;
}[];
lat: number;
long: number;
owner_id: number;
photo_256: string;
place: string;
post_id: number;
sizes: {
height: number;
src: string;
type: | "max"
| "k"
| "a"
| "b"
| "i"
| "p"
| "q"
| "s"
| "g"
| "d"
| "r"
| "x"
| "y"
| "m"
| "l"
| "o"
| "z"
| "w"
| "c"
| "e"
| "j"
| "temp"
| "h"
| "n"
| "f";
url: string;
width: number;
}[];
text: string;
user_id: number;
width: number;
};
rect: {
x: number;
x2: number;
y: number;
y2: number;
};
};
裁剪
crop: {
x: number;
x2: number;
y: number;
y2: number;
};
裁剪.x
x: number;
裁剪.x2
x2: number;
裁剪.y
y: number;
裁剪.y2
y2: number;
照片
photo: {
access_key: string;
album_id: number;
can_comment: 0 | 1;
date: number;
has_tags: boolean;
height: number;
id: number;
images: {
height: number;
type: | "p"
| "q"
| "s"
| "r"
| "x"
| "y"
| "m"
| "l"
| "o"
| "z"
| "w";
url: string;
width: number;
}[];
lat: number;
long: number;
owner_id: number;
photo_256: string;
place: string;
post_id: number;
sizes: {
height: number;
src: string;
type: | "max"
| "k"
| "a"
| "b"
| "i"
| "p"
| "q"
| "s"
| "g"
| "d"
| "r"
| "x"
| "y"
| "m"
| "l"
| "o"
| "z"
| "w"
| "c"
| "e"
| "j"
| "temp"
| "h"
| "n"
| "f";
url: string;
width: number;
}[];
text: string;
user_id: number;
width: number;
};
照片.访问密钥?
optional access_key: string;
照片.相册ID
album_id: number;
照片.可以评论?
optional can_comment: 0 | 1;
照片.日期
date: number;
照片.有标签?
has_tags: boolean;
照片.高度?
optional height: number;
照片.ID
id: number;
照片.图片?
optional images: {
height: number;
type: | "p"
| "q"
| "s"
| "r"
| "x"
| "y"
| "m"
| "l"
| "o"
| "z"
| "w";
url: string;
width: number;
}[];
照片.纬度?
optional lat: number;
照片.经度?
optional long: number;
照片.所有者ID
owner_id: number;
照片.照片_256?
optional photo_256: string;
照片.位置?
optional place: string;
照片.帖子ID?
optional post_id: number;
照片.大小?
optional sizes: {
height: number;
src: string;
type: | "max"
| "k"
| "a"
| "b"
| "i"
| "p"
| "q"
| "s"
| "g"
| "d"
| "r"
| "x"
| "y"
| "m"
| "l"
| "o"
| "z"
| "w"
| "c"
| "e"
| "j"
| "temp"
| "h"
| "n"
| "f";
url: string;
width: number;
}[];
照片.文本?
optional text: string;
照片.用户ID?
optional user_id: number;
照片.宽度?
optional width: number;
矩形
rect: {
x: number;
x2: number;
y: number;
y2: number;
};
矩形.x
x: number;
矩形.x2
x2: number;
矩形.y
y: number;
矩形.y2
y2: number;
已停用?
optional deactivated: string;
域名?
optional domain: string;
教育?
optional education: {
faculty: number;
faculty_name: string;
graduation: number;
university: number;
university_name: string;
};
院系?
optional faculty: number;
院系名称?
optional faculty_name: string;
毕业?
optional graduation: number;
大学?
optional university: number;
大学名称?
optional university_name: string;
电子邮件?
optional email: string;
导出?
optional exports: {
facebook: number;
instagram: number;
livejournal: number;
twitter: number;
};
Facebook?
optional facebook: number;
Instagram?
optional instagram: number;
LiveJournal?
optional livejournal: number;
Twitter?
optional twitter: number;
名字
first_name: string;
名字.abl
optional first_name_abl: string;
名字.acc
optional first_name_acc: string;
名字.dat
optional first_name_dat: string;
名字.gen
optional first_name_gen: string;
名字.ins
optional first_name_ins: string;
名字.nom
optional first_name_nom: string;
关注者数量?
optional followers_count: number;
好友状态?
optional friend_status: 0 | 2 | 1 | 3;
游戏?
optional games: string;
有手机?
optional has_mobile: 0 | 1;
有照片?
optional has_photo: 0 | 1;
家乡?
optional home_town: string;
ID
id: number;
兴趣?
optional interests: string;
已关闭
is_closed: boolean;
是收藏?
optional is_favorite: 0 | 1;
是朋友?
optional is_friend: 0 | 1;
从信息流中隐藏?
optional is_hidden_from_feed: 0 | 1;
是无索引?
optional is_no_index: 0 | 1;
姓氏
last_name: string;
姓氏.abl
optional last_name_abl: string;
姓氏.acc
optional last_name_acc: string;
姓氏.dat
optional last_name_dat: string;
姓氏.gen
optional last_name_gen: string;
姓氏.ins
optional last_name_ins: string;
姓氏.nom
optional last_name_nom: string;
最后看到?
optional last_seen: {
platform: | 2
| 1
| 5
| 3
| 4
| 6
| 7;
time: number;
};
平台?
optional platform:
| 2
| 1
| 5
| 3
| 4
| 6
| 7;
时间?
optional time: number;
娘家姓?
optional maiden_name: string;
军队?
optional military: {
country_id: number;
from: number;
unit: string;
unit_id: number;
until: number;
};
国家ID
country_id: number;
从?
optional from: number;
单位
unit: string;
单位ID
unit_id: number;
直到?
optional until: number;
电影?
optional movies: string;
音乐?
optional music: string;
昵称?
optional nickname: string;
职业?
optional occupation: {
id: number;
name: string;
type: "work" | "school" | "university";
};
ID?
optional id: number;
名称?
optional name: string;
类型?
optional type: "work" | "school" | "university";
在线?
optional online: 0 | 1;
在线应用?
optional online_app: number;
在线手机?
optional online_mobile: 0 | 1;
个人?
optional personal: {
alcohol: | 2
| 1
| 5
| 3
| 4;
inspired_by: string;
langs: string[];
life_main: | 2
| 1
| 5
| 3
| 4
| 6
| 7
| 8;
people_main: | 2
| 1
| 5
| 3
| 4
| 6;
political: | 2
| 1
| 5
| 3
| 4
| 6
| 7
| 8
| 9;
religion: string;
smoking: | 2
| 1
| 5
| 3
| 4;
};
酒精?
optional alcohol:
| 2
| 1
| 5
| 3
| 4;
灵感来源?
optional inspired_by: string;
语言?
optional langs: string[];
生活价值?
optional life_main:
| 2
| 1
| 5
| 3
| 4
| 6
| 7
| 8;
人际价值?
optional people_main:
| 2
| 1
| 5
| 3
| 4
| 6;
政治?
optional political:
| 2
| 1
| 5
| 3
| 4
| 6
| 7
| 8
| 9;
宗教?
optional religion: string;
吸烟?
optional smoking:
| 2
| 1
| 5
| 3
| 4;
照片_100
photo_100: string;
照片_200?
optional photo_200: string;
照片_200_orig?
optional photo_200_orig: string;
照片_400?
optional photo_400: string;
照片_400_orig?
optional photo_400_orig: string;
照片_50
optional photo_50: string;
照片ID?
optional photo_id: string;
照片_max
optional photo_max: string;
照片_max_orig?
optional photo_max_orig: string;
语录?
optional quotes: string;
关系?
optional relation:
| 0
| 2
| 1
| 5
| 3
| 4
| 6
| 7
| 8;
关系伙伴?
optional relation_partner: {
can_access_closed: boolean;
deactivated: string;
first_name: string;
hidden: number;
id: number;
is_closed: boolean;
last_name: string;
};
可以访问封闭的?
optional can_access_closed: boolean;
已停用?
optional deactivated: string;
名字
first_name: string;
隐藏?
optional hidden: number;
ID
id: number;
已封闭?
optional is_closed: boolean;
姓氏
last_name: string;
亲属?
optional relatives: {
id: number;
name: string;
type: | "parent"
| "child"
| "grandparent"
| "grandchild"
| "sibling";
}[];
学校?
optional schools: {
city: number;
class: string;
country: number;
id: string;
name: string;
speciality: string;
type: number;
type_str: string;
year_from: number;
year_graduated: number;
year_to: number;
}[];
屏幕名称?
optional screen_name: string;
性别?
optional sex: 0 | 2 | 1;
站点?
optional site: string;
状态?
optional status: string;
状态音频?
optional status_audio: {
access_key: string;
album_id: number;
artist: string;
date: number;
duration: number;
genre_id: number;
id: number;
owner_id: number;
performer: string;
title: string;
url: string;
};
访问密钥?
optional access_key: string;
相册ID?
optional album_id: number;
艺术家
artist: string;
日期?
optional date: number;
持续时间
duration: number;
流派ID?
optional genre_id: number;
ID
id: number;
所有者ID
owner_id: number;
表演者?
optional performer: string;
标题
title: string;
网址?
optional url: string;
时区?
optional timezone: number;
趋势?
optional trending: 0 | 1;
电视?
optional tv: string;
大学?
optional universities: {
chair: number;
chair_name: string;
city: number;
country: number;
education_form: string;
education_status: string;
faculty: number;
faculty_name: string;
graduation: number;
id: number;
name: string;
university_group_id: number;
}[];
已验证?
optional verified: 0 | 1;
墙默认?
optional wall_default: "all" | "owner";
默认()
default<P>(options): OAuthConfig<P>
在您的页面上添加VK登录。
设置
回调URL
https://example.com/api/auth/callback/vk
配置
import { Auth } from "@auth/core"
import VK from "@auth/core/providers/vk"
const request = new Request(origin)
const response = await Auth(request, {
providers: [VK({ clientId: VK_CLIENT_ID, clientSecret: VK_CLIENT_SECRET })],
})
资源
注释
默认情况下,Auth.js 假设 VK 提供程序基于 OAuth 2 规范。
💡
VK 提供程序带有一个 默认配置。要覆盖您的用例的默认值,请查看 自定义内置 OAuth 提供程序。
默认情况下,提供程序使用 API 的 5.126 版本。有关更多信息,请参阅 https://vk.com/dev/versions。如果您想使用其他版本,可以将其传递给提供程序的选项对象
const apiVersion = "5.126"
providers: [
Vk({
accessTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`,
requestTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`,
authorizationUrl:
`https://oauth.vk.com/authorize?response_type=code&v=${apiVersion}`,
profileUrl: `https://api.vk.com/method/users.get?fields=photo_100&v=${apiVersion}`,
})
]
类型参数
类型参数 | 值 |
---|---|
P extends Record <string , any > | VkProfile |
参数
参数 | 类型 |
---|---|
选项 | OAuthUserConfig <P > |
返回
OAuthConfig
<P
>