Google APIs with Paw
Register with Google
Register with Google
- Create a new project or pick an existing one at Google Developer Console
- Select Use Google APIs to enable needed Google APIs. In our example, we have enabled the Google Apps APIs > Drive API:
- Then, switch to the Credentials tab, and create credentials if needed (follow the workflow and create an OAuth Client)
- On Credentials tab, under OAuth 2.0 client IDs, hit the Donwload button JSON file
- You’ll get a JSON file containing all the credentials and URLs you need to setup OAuth 2
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 Google Drive User Files)
Use the API (example: List Google Drive User Files)
We will now setup Paw for listing the Google Drive files for this user:
- Method: select
GET
- URL: enter as
https://www.googleapis.com/drive/v2/files
as URL
- Request Name: give a user-friendly name to this request in Paw, like “Google Drive User Files”
Learn more about Google APIs.
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.