GitHub API with Paw
Register App with GitHub
Register App with GitHub
First step here is to find the client or app credentials (Client ID & Client Secret).
- Go to your GitHub settings
- Select Applications > Developer applications tab.
- Pick an existing application or hit Register new application.
- Set a few parameters for your application and get the Client ID and Client Secret.
Authorize (get the Access Token)
Authorize (get the Access Token)
Now that you’ve setup the OAuth settings, you can manually request an access token, or skip this section and let Paw automatically handle authorization when needed (when sending request, Paw will automatically ask authorization if there is no access token or if it has expired).
In Paw, hit the Get Access Token button from the OAuth2 Dynamic Value
.
A web view is shown and you’re prompted (as the end-users would be) to authorize your app to access the provider’s API.
Once done, you’re redirected to the “Callback URL” page (should be a page on the client server). It doesn’t matter if that page is not functional yet. At this step, Paw will be calling the “Access Token URL” to get a token in exchange of the code that has been returned by the OAuth provider.
The Access Token should now appear at the bottom of the window. Hit the Use Access Token button.
Your request is now configured to be using OAuth 2.
Use the API (example: List GitHub User Repositories)
Use the API (example: List GitHub User Repositories)
We will now setup Paw for listing the GitHub repositories for this user:
- Method: select
GET
- URL: enter as
https://api.github.com/user/repos
as URL
- Request Name: give a user-friendly name to this request in Paw, like “GitHub User Repositories”
Learn more about GitHub API.
Use Environment Variables
Use Environment Variables
As you may often switch between development and production environments, or between several users, you may need to have several OAuth credentials you may apply to your Requests. You can keep those credentials in Environments, and then use them in the OAuth Header Dynamic Value.
Read more about Environments and how to use Environments as Reusable Presets.