Github OAuth API Management

This is a simple example of setting up a Github OAuth application, and using it for the login, and API keys for any API. All it does is login you using your Github account, then redirects back here and adding your username as appid, and a valid OAuth token as an appkeky--which can be used as API credentials, as well as working with a users Github account, depending on the application settings.

  • x-appid - Your user.
  • x-appkey - Your token.

Below is the JavaScript that is embedded on this page, and the PHP script I use to handle the OAuth login. All you do is setup your own Github OAuth applicaiton under your account, replace the keys in the script, and the URL back to your application. This script doesn't do anything with the OAuth token, but you can easily save them, or register them in another system for usage in another API management layer like AWS API Gateway, or other solution.


JavaScript

PHP Script