MCPcopy Create free account
hub / github.com/Semporia/Scripts / getToken

Function getToken

jd_EsportsManager.js:278–314  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

276}
277
278function getToken() {
279 let config = {
280 url: 'https://xinruidddj-isv.isvjcloud.com/api/user/jd/auth',
281 body: `token=${$.token2}&source=01`,
282 headers: {
283 'Host': 'xinruidddj-isv.isvjcloud.com',
284 'Accept': 'application/json, text/plain, */*',
285 'Origin': 'https://xinruidddj-isv.isvjcloud.com',
286 'Authorization': 'Bearer undefined',
287 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;10.0.2;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
288 'Sec-Fetch-Mode': 'cors',
289 'X-Requested-With': 'com.jingdong.app.mall',
290 'Sec-Fetch-Site': 'same-origin',
291 'Referer': 'https://xinruidddj-isv.isvjcloud.com/exception/?channel=DDLY&sid=fd5e44488241862af88cb40cbebf660w&un_area=12_904_3373_62101',
292 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
293 'Cookie': `IsvToken=${$.isvToken};`
294 },
295 }
296 return new Promise(resolve => {
297 $.post(config, async (err, resp, data) => {
298 try {
299 if (err) {
300 console.log(`${JSON.stringify(err)}`)
301 console.log(`${$.name} API请求失败,请检查网路重试`)
302 } else {
303 data = JSON.parse(data);
304 $.token = data.body.access_token
305 console.log($.token)
306 }
307 } catch (e) {
308 $.logErr(e, resp)
309 } finally {
310 resolve(data);
311 }
312 })
313 })
314}
315
316function detail() {
317 return new Promise(resolve => {

Callers 1

Calls 5

isNodeMethod · 0.45
getdataMethod · 0.45
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected