From the course: Building Your First CLI App in Node
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Store GitHub credentials for reuse
From the course: Building Your First CLI App in Node
Store GitHub credentials for reuse
- [Instructor] What we have completed so far has created must of the functionality in the program to receive GitHub credentials. However, your local computer or program are not themselves yet equipped to sign into GitHub, since the program is not yet connected to the GitHub API. In order to have the user actually sign in to GitHub, you will have to retrieve an OAuth token for the GitHub API. We will exchange the username and password we received in our program for a GitHub token. Once we have the credentials from the user, we don't want them to have to sign in every time they use the tool. Instead, what we'll do is store the OAuth token so it's always available to the user. How do we do that? At its most basic, storing config is rather simple. You could do it without a package by simply reading and writing to and from a JSON file. We will, however, use the configstore package in this project because it provides a few key advantages. First, the package determines the most appropriate…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Understand user prompts1m 46s
-
(Locked)
Create a prompt for user input2m 24s
-
(Locked)
Validate user input1m 53s
-
(Locked)
Store GitHub credentials for reuse3m 2s
-
(Locked)
Receive the GitHub token3m 39s
-
(Locked)
Authenticate with GitHub2m 29s
-
(Locked)
Register a new token3m 23s
-
(Locked)
Implement the GitHub token3m 31s
-
-
-
-