Skip to content

用户

查询用户信息。如果未公开邮箱,属性 email 会返回 null 。

const TOKEN = '123456';

const url = 'https://api.github.com/user';
const options = { method: 'GET', headers: { Authorization: 'Bearer ' + TOKEN } };

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}

联系 math@baima.site