const client = new Client({
appId: '2TLyMobqEWuwgiyTLaMNOLce-gzGzoHsz',
appKey: '7skKyRM5qiwbBmIiM2xi7lMm',
playServer: 'https://2tlymobq.lc-cn-n1-shared.com',
userId: '1',
})
await client.connect()
会发请求
https://2tlymobq.lc-cn-n1-shared.com/1/multiplayer/router/authorize
跨域报错
option预检请求返回的相应头
access-control-allow-headers:Content-Type,X-XSRF-TOKEN,X-CSRF-TOKEN,X-LC-Id,X-LC-Key,X-LC-Prod,X-LC-Session,X-LC-Sign,X-LC-UA,X-LC-IM-Session-Token,X-LC-Hook-Key
缺少x-lc-play-user-id
导致报错
localhost/:1 Access to XMLHttpRequest at 'https://2tlymobq.lc-cn-n1-shared.com/1/multiplayer/router/authorize' from origin 'http://localhost:5173' has been blocked by CORS policy: Request header field x-lc-play-user-id is not allowed by Access-Control-Allow-Headers in preflight response.