Replies: 3 comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Authenticating to the REST API with an OAuth app - Using Bash
Note
Be sure to check out Best practices for creating an OAuth app
We're going to run through a simplified exercise of generating an OAuth Application Token (gho_****). Specifically, we're going to create a Bash Script that uses the OAuth App's
client ID
andclient secret
which are used to perform operations on behalf of the app, such as creating the access tokens.High Level Overview
<string>
, paste the code string, grabgho_****
Step 1 - Create OAuth App grabbing the ID and Secret
This is by far the easiest step!
Simply follow the instructions found in the GitHub Documentation for Registering your app.
Except for one caveat, here we are not going to use some backend server for the
Authorization callback URLs
. Instead we will just usehttp://127.0.0.1/callback
or in another words, just your local machine to do all the work (all you need is a web browser!).Step 2 - Run the script, interactively choose what scopes you want
So setting up the Bash piece was a bit tricky, converting the Guide from using a
Ruby
Server.The following script is designed to do the following:
bash run.sh <CLIENT_ID> <CLIENT_SECRET>
Authorizing will redirect to http://127.0.0.1
http://127.0.0.1/code=<string>&state=...
from the URL Bar of your browser.Enter the code:
to get agho_****
token.Expand Bash Script
Step 3 - Profit
Now that we have our
gho_****
OAuth Token, we can now use that where we please 🐧 🐧Beta Was this translation helpful? Give feedback.
All reactions