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

Store GitHub credentials for reuse

From the course: Building Your First CLI App in Node

Start my 1-month free trial

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…

Contents