This demo shows how to use the package to retrieve an authToken from Github, allowing you to perform operations on Github repos.
To use the demo, fill out the following information.
You can enter your client_id and client_secret to test the server.
We don't store it. We only use it temporarily to demo authentication, but feel free to regenerate a new client_secret after testing the demo.
This can be your Github app_id or anything you choose
Paste the client_id from the github app
👁️
Paste the client_secret from the github app
The url this goes too after fetching the auth_token from github. In this demo, this goes to a page that displays just the result.
Then, the following url need to be added to your github app's callbackUrls for the authentication flow to work:
The app_id, client_id and client_secret needs to be added to the server:
import { GithubAuthServer } from "simple-github-authentication";
import express from "express";
const app = express();
new GithubAuthServer(app, {
clientConfigs: [{
app_id: "",
client_id: '',
client_secret: '',
callback: '',
}],
});
For this test, you can use the following button in place of the code above.
Note: For your security, the client is registered for only 1 request, and will expire after 1 min if not used.
Note: Due to CORS restriction, you cannot make a POST call directly into Github API from a browser.
To address that for the demo, we bypass that restriction by going through a proxy.
To enable that proxy, first click on https://cors-anywhere.herokuapp.com/corsdemo
and click on [Request temporary access]
Then the following link opens the Github login page to fetch the auth token: