Facebook API with Paw
Register with Facebook
Register with Facebook
- Create a new app or pick an existing one at Facebook Developer Apps
- Select the Dashboard tab and save the codes under App ID (OAuth2 Client ID) and App Secret (OAuth2 Client Secret)
- Select Settings > Advanced tab and, under Client OAuth Settings:
- Enable Client OAuth Login
- Enable Web OAuth Login
- Add the URI API users should be redirected after authorization under Valid OAuth redirect URIs
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 Facebook User Photos)
Use the API (example: List Facebook User Photos)
We will now setup Paw for listing the Facebook photos from this user:
- Method: select
GET
- URL: enter as
https://graph.facebook.com/me/photos
as URL
- Request Name: give a user-friendly name to this request in Paw, like “Facebook User Photos”
Learn more about Facebook 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.