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;
連線?
optional connections: {
facebook: string;
instagram: string;
livejournal: string;
skype: string;
twitter: string;
};
臉書?
optional facebook: string;
Instagram?
optional instagram: string;
LiveJournal?
optional livejournal: string;
Skype?
optional skype: string;
推特?
optional twitter: string;
聯絡人?
optional contacts: {
home_phone: string;
mobile_phone: string;
};
住家電話?
optional home_phone: string;
手機號碼?
optional mobile_phone: string;
計數器?
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;
};
臉書?
optional facebook: number;
Instagram?
optional instagram: number;
LiveJournal?
optional livejournal: number;
推特?
optional twitter: number;
名字
first_name: string;
名字(工具格)?
optional first_name_abl: string;
名字(受格)?
optional first_name_acc: string;
名字(與格)?
optional first_name_dat: string;
名字(屬格)?
optional first_name_gen: string;
名字(工具格)?
optional first_name_ins: string;
名字(主格)?
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;
姓氏(工具格)?
optional last_name_abl: string;
姓氏(受格)?
optional last_name_acc: string;
姓氏(與格)?
optional last_name_dat: string;
姓氏(屬格)?
optional last_name_gen: string;
姓氏(工具格)?
optional last_name_ins: string;
姓氏(主格)?
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?
optional photo_200_orig: string;
照片_400?
optional photo_400: string;
原始照片_400?
optional photo_400_orig: string;
照片_50?
optional photo_50: string;
照片_id?
optional photo_id: string;
照片_最大尺寸?
optional photo_max: string;
原始照片_最大尺寸?
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 登入新增至您的頁面。
設定
回呼網址
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 延伸自 Record <string , any > | VkProfile |
參數
參數 | 類型 |
---|---|
options | OAuthUserConfig <P > |
傳回
OAuthConfig
<P
>