How to use the authenticate function from @octokit/rest

Find comprehensive JavaScript @octokit/rest.authenticate code examples handpicked from public code repositorys.

0
1
2
3
4
5
6
7
8
const parse = require('parse-github-url');
const octokit = require('@octokit/rest')();
const {execSync} = require('child_process');

module.exports = async function ({change, branch}) {
    octokit.authenticate({
        type: 'token',
        token: process.env.GITHUB_TOKEN
    });
fork icon7
star icon16
watch icon77

16
17
18
19
20
21
22
23
24
25
const generateViewState = (configuration) => {
    showIssues = configuration.showIssues.value === 'true'
    showPRs = configuration.showPRs.value === 'true'
    show_details_threshold = parseInt(configuration.showDetailsThreshold.value, 10)

    octokit.authenticate({type: 'oauth', token: configuration.token.value})

    return paginate(octokit.repos.getForOrg)
        .then(data => Promise.all(data.map(queryRepoIssues)))
        .then(repos => repos.filter(each => each.prs.length > 0 || each.issues.length > 0)) // remove repositories with no open prs or issues
fork icon2
star icon0
watch icon2

1
2
3
4
5
6
7
8
9
10
  debug: true
})

class GithubApiFunctions {
  constructor (token) {
    octokit.authenticate({ type: 'oauth', token: token })
  }
  
  async userProfile() {
    try {
fork icon0
star icon1
watch icon4