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
- Host: GitHub
- URL: https://github.com/tintinweb/github-deviceauth
- Owner: tintinweb
- License: mit
- Created: 2024-12-09T14:59:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-09T15:08:28.000Z (about 1 year ago)
- Last Synced: 2024-12-09T16:25:40.620Z (about 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
})();
```