-
I'm mimicking the code of the doc, trying to get "login", but I got an error message: Here's my code const { Octokit } = require('@octokit/rest');
const dotenv = require('dotenv')
dotenv.config({})
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
(async () => {
const {
data: { login },
} = await octokit.rest.users.getAuthenticated();
console.log("Hello, %s", login);
})(); This is the code from the doc // Create a personal access token at https://github.com/settings/tokens/new?scopes=repo
const octokit = new Octokit({ auth: `personal-access-token123` });
// Compare: https://docs.github.com/en/rest/reference/users#get-the-authenticated-user
const {
data: { login },
} = await octokit.rest.users.getAuthenticated();
console.log("Hello, %s", login); |
Beta Was this translation helpful? Give feedback.
Answered by
wolfy1339
Sep 8, 2022
Replies: 1 comment 3 replies
-
Can you post which version and environment you are using |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
BitComing
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you post which version and environment you are using