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

Function getToken

jd_beauty.js:593–630  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

591}
592
593function getToken() {
594 let config = {
595 url: 'https://xinruimz-isv.isvjcloud.com/api/auth',
596 body: JSON.stringify({"token":$.token2,"source":"01"}),
597 headers: {
598 'Host': 'xinruimz-isv.isvjcloud.com',
599 'Accept': 'application/x.jd-school-island.v1+json',
600 'Source': '02',
601 'Accept-Language': 'zh-cn',
602 'Content-Type': 'application/json;charset=utf-8',
603 'Origin': 'https://xinruimz-isv.isvjcloud.com',
604 '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"),
605 'Referer': 'https://xinruimz-isv.isvjcloud.com/logined_jd/',
606 'Authorization': 'Bearer undefined',
607 'Cookie': `IsvToken=${$.isvToken};`
608 }
609 }
610 return new Promise(resolve => {
611 $.post(config, async (err, resp, data) => {
612 try {
613 if (err) {
614 console.log(`${JSON.stringify(err)}`)
615 console.log(`${$.name} API请求失败,请检查网路重试`)
616 } else {
617 if (safeGet(data)) {
618 data = JSON.parse(data);
619 $.token = data.access_token
620 console.log(`【$.token】 ${$.token}`)
621 }
622 }
623 } catch (e) {
624 $.logErr(e, resp)
625 } finally {
626 resolve(data);
627 }
628 })
629 })
630}
631
632function showMsg() {
633 return new Promise(resolve => {

Callers 1

accountCheckFunction · 0.70

Calls 6

safeGetFunction · 0.70
isNodeMethod · 0.45
getdataMethod · 0.45
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected