fix(auth): correct Facebook Graph field expansion syntax for picture
Facebook Graph API field expansion uses parentheses, not equals signs. The buggy `picture.type=large` produced HTTP 400 with `OAuthException code 2500: Syntax error ... at character 32`. Fix `FIELDS` constant and 2 JSDoc comment lines in facebook-graph.ts to use `picture.type(large)` per Facebook's documented syntax. Effect: after Facebook OAuth sync, `fetchFacebookUserData` now succeeds (HTTP 200), `UserStorage.setAvatarUrl` and `AuthStorage.setFacebookId` get populated, and the `[auth-machine] syncFacebookBackendActor: fetchFacebookUserData failed (continuing anyway)` warning stops firing on the happy path.
This commit is contained in:
@@ -14,8 +14,8 @@
|
|||||||
* 不引入 Facebook SDK(window.FB)—— 减少前端 bundle 体积,Graph API
|
* 不引入 Facebook SDK(window.FB)—— 减少前端 bundle 体积,Graph API
|
||||||
* 单次 HTTP 调用即可拿到所有字段。SDK 加载慢、还要管 init。
|
* 单次 HTTP 调用即可拿到所有字段。SDK 加载慢、还要管 init。
|
||||||
*
|
*
|
||||||
* 端点:`https://graph.facebook.com/me?fields=id,name,email,picture.type=large&access_token=...`
|
* 端点:`https://graph.facebook.com/me?fields=id,name,email,picture.type(large)&access_token=...`
|
||||||
* - `picture.type=large` 返回 ~200px 头像 URL(默认 square 50px 太小)
|
* - `picture.type(large)` 返回 ~200px 头像 URL(默认 square 50px 太小)
|
||||||
* - 不指定 version 走最新稳定版
|
* - 不指定 version 走最新稳定版
|
||||||
* - 不需要 appId / appSecret(accessToken 自身就是凭证)
|
* - 不需要 appId / appSecret(accessToken 自身就是凭证)
|
||||||
*/
|
*/
|
||||||
@@ -31,9 +31,9 @@ const GRAPH_ME_URL = "https://graph.facebook.com/me";
|
|||||||
/**
|
/**
|
||||||
* 拉取字段集合:
|
* 拉取字段集合:
|
||||||
* - id / name / email —— 给本地 FacebookUserData DTO
|
* - id / name / email —— 给本地 FacebookUserData DTO
|
||||||
* - picture.type=large —— 头像 URL(默认 square 50px 太小)
|
* - picture.type(large) —— 头像 URL(默认 square 50px 太小)
|
||||||
*/
|
*/
|
||||||
const FIELDS = "id,name,email,picture.type=large";
|
const FIELDS = "id,name,email,picture.type(large)";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用 accessToken 调 Facebook Graph `/me` 拉用户资料。
|
* 用 accessToken 调 Facebook Graph `/me` 拉用户资料。
|
||||||
|
|||||||
Reference in New Issue
Block a user