An open API service indexing awesome lists of open source software.

https://github.com/tintinweb/github-deviceauth

A minimalistic library to perform GitHub OAuth via the DeviceAuth Flow
https://github.com/tintinweb/github-deviceauth

Last synced: 3 months ago
JSON representation

A minimalistic library to perform GitHub OAuth via the DeviceAuth Flow

Awesome Lists containing this project

README

          

# github-deviceauth

A minimalistic library to perform GitHub OAuth via the DeviceAuth Flow

## Example

```javascript

const { GithubDeviceAuth } = require("../src/index");

(async () => {
const auth = new GithubDeviceAuth({ clientId: '...clientId....', scope: '' });

const result = await auth.authenticate({
statusCallback: async (data) => {
// all status updates
console.log(data);
},
deviceCodeCallback: async (deviceData) => {
// requestDeviceCode response
console.log('Visit the following URL in your browser and enter the user code:');
console.log(deviceData.verification_uri);
console.log('User Code: ' + deviceData.user_code);
console.log('Expires in: ' + deviceData.expires_in + ' seconds');
}
});
console.log(result); // success; users auth token
})();

```