Fetch Cross-domain POST reports 401 Unauthorized

export const login = accesstoken => dispatch => {
  return fetch("https://cnodejs.org/api/v1/accesstoken", {
    method: "POST",
    body: JSON.stringify({ accesstoken })
  }).then(res => {
    if (res.ok) {
      return res.json()
    } else {
      return Promise.reject(res.statusText)
    }
  }).then(({
    loginname
  }) => Promise.resolve(loginname))
}

as above, the native Fetch interface of the browser is used, but because the cross-domain POST request is involved, the OPTIONS request is not sent in advance, so 401 is returned directly. Is there any better solution?

Feb.26,2021

  preflight request . 

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c2ee4e-33c1b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c2ee4e-33c1b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?