From the course: Building Your First CLI App in Node

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Register a new token

Register a new token

From the course: Building Your First CLI App in Node

Start my 1-month free trial

Register a new token

- [Instructor] The next thing we're going to do is build our registerNewToken function. Let's use a try statement to check whether authentication and registering a new oauth token works or not. First, we will try to get the token, as defined here, and we're going to store this inside of response const, and what we're doing is waiting for our our octokit to return something to us. Inside of this createAuthorization, we also need to set some scopes, and a note for whoever receives the token about what app we have. We're setting these for user, public_repo, repo, as well as the repo:status. The last thing we're going to set in here is a note. This note is going to be registered on all of the tokens that you place on other users' profiles, so this is just to let them know what app has been there with a token. So I'm going to say "musette: a cool tool for dev workflow automation." These scopes are keys which specify the permissions the application requires. If you don't specify a scopes…

Contents