How to create OAuth credentials for Meta apps (Facebook)
How to create OAuth credentials for Meta apps (Facebook)
In this guide, I will share the process of customizing the auth config for Facebook. The same process applies to other Meta apps, such as WhatsApp.
So, let's begin.
Setting up Facebook
In this section, we’ll go through the process of creating an application and setting up Facebook to access the Client ID (App ID) and Client Secret (App Secret).
NOTE: If you already have an application in Facebook and can access the Client ID and Client Secret, you can skip to Step 3.
Step 1: Create a Facebook developer account
Visit Meta For Developers and create a new developer account.
A developer account is required because you’ll need to create an app, which must be linked to a developer account and a business portfolio in order to work with the Facebook API.
Step 1: Create an application
Once your developer account is ready, you can create a public app and generate the OAuth Client ID and Client Secret.
Navigate to your developer account.
In the top-right corner, click Create App.

Enter your basic app details, select the relevant use-cases based on your workflow, and for the business tab, select the business you just created.

Now, fill in the remaining details as requested, and you should be able to create the application.
Step 2: Copy the OAuth Credentials
Once your application is created, you can easily access the Client ID and Client Secret.
Navigate to the application you just created.
Under the App Settings tab, in the Basic section, you can find the Client ID (App ID) and Client Secret (App Secret).

Step 3: Set the Authorized Redirect URI
You'll also need to configure the Authorized Redirect URI of the application to point to Composio's callback URL.
In the App Settings, under the Advanced tab in the redirect allow list, add the following URL:
<https://backend.composio.dev/api/v3/toolkits/auth/callback>

With all of that, you can finally publish the application. That's all you need to set up on the Facebook side.
Creating the Auth Config in Composio
With your OAuth credentials ready, navigate to the Composio dashboard for your project to configure the authentication settings for Facebook.
Click on the Create Auth Config button to get a list of all the toolkits available.

In the sidebar that opens, choose Facebook for the toolkit. Ensure the authentication is set to OAuth2 as the default. There is no support for Bearer Token with Facebook.

Ensure that "Use your own developer authentication" is selected, as this is the primary purpose.

Paste the Client ID (App ID) and Client Secret (App Secret) you just copied from Facebook into their respective fields.

The Base URL should already be pre-filled, but if not, set it to:
<https://graph.facebook.com>
This is the endpoint for all Facebook API calls.
Then, simply click Create Facebook Auth Config.
Once you have set up the auth config for Facebook, you can go to the Manage Auth Config tab to make changes to any auth config fields. Here, you can also customize the auth scopes if needed. Default scopes are already pre-filled for most apps.

Once done, copy the auth config ID (which starts with ac_
) and use it in your application code via a secret manager.
Your custom Facebook auth config is now ready to go! 🚀
Extending to Other Meta Apps
In the section above, we learned how to set up OAuth for Facebook. If you want to connect other Meta apps, like WhatsApp, you can follow similar steps to integrate them into your Composio setup.
Overall, you need to obtain the OAuth credentials, such as the Client ID and Client Secret, for these other apps and then follow the same steps to configure the auth settings in Composio.
In this guide, I will share the process of customizing the auth config for Facebook. The same process applies to other Meta apps, such as WhatsApp.
So, let's begin.
Setting up Facebook
In this section, we’ll go through the process of creating an application and setting up Facebook to access the Client ID (App ID) and Client Secret (App Secret).
NOTE: If you already have an application in Facebook and can access the Client ID and Client Secret, you can skip to Step 3.
Step 1: Create a Facebook developer account
Visit Meta For Developers and create a new developer account.
A developer account is required because you’ll need to create an app, which must be linked to a developer account and a business portfolio in order to work with the Facebook API.
Step 1: Create an application
Once your developer account is ready, you can create a public app and generate the OAuth Client ID and Client Secret.
Navigate to your developer account.
In the top-right corner, click Create App.

Enter your basic app details, select the relevant use-cases based on your workflow, and for the business tab, select the business you just created.

Now, fill in the remaining details as requested, and you should be able to create the application.
Step 2: Copy the OAuth Credentials
Once your application is created, you can easily access the Client ID and Client Secret.
Navigate to the application you just created.
Under the App Settings tab, in the Basic section, you can find the Client ID (App ID) and Client Secret (App Secret).

Step 3: Set the Authorized Redirect URI
You'll also need to configure the Authorized Redirect URI of the application to point to Composio's callback URL.
In the App Settings, under the Advanced tab in the redirect allow list, add the following URL:
<https://backend.composio.dev/api/v3/toolkits/auth/callback>

With all of that, you can finally publish the application. That's all you need to set up on the Facebook side.
Creating the Auth Config in Composio
With your OAuth credentials ready, navigate to the Composio dashboard for your project to configure the authentication settings for Facebook.
Click on the Create Auth Config button to get a list of all the toolkits available.

In the sidebar that opens, choose Facebook for the toolkit. Ensure the authentication is set to OAuth2 as the default. There is no support for Bearer Token with Facebook.

Ensure that "Use your own developer authentication" is selected, as this is the primary purpose.

Paste the Client ID (App ID) and Client Secret (App Secret) you just copied from Facebook into their respective fields.

The Base URL should already be pre-filled, but if not, set it to:
<https://graph.facebook.com>
This is the endpoint for all Facebook API calls.
Then, simply click Create Facebook Auth Config.
Once you have set up the auth config for Facebook, you can go to the Manage Auth Config tab to make changes to any auth config fields. Here, you can also customize the auth scopes if needed. Default scopes are already pre-filled for most apps.

Once done, copy the auth config ID (which starts with ac_
) and use it in your application code via a secret manager.
Your custom Facebook auth config is now ready to go! 🚀
Extending to Other Meta Apps
In the section above, we learned how to set up OAuth for Facebook. If you want to connect other Meta apps, like WhatsApp, you can follow similar steps to integrate them into your Composio setup.
Overall, you need to obtain the OAuth credentials, such as the Client ID and Client Secret, for these other apps and then follow the same steps to configure the auth settings in Composio.