Question

Can't connect FreePBX Rest Interface (FreePBX business app)

I’ve deployed FreePBX business app to DO droplet server. As I was following this guide (https://sangomakb.atlassian.net/wiki/spaces/PG/pages/25690223/REST+API) I could not get new access token. It gives me an eror “invalid client”. Here is my configuration in Postman. image alt text I could not fill the available token input (bearer token). I am not sure where I can get it. New token configuration has same data with one in my FreePBX web admin panel. Please let me know what I’ve missed.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
January 12, 2024

Hi there!

This error typically points to an issue with the OAuth client credentials or the configuration in Postman. Here are a few things that I would recommend checking:

1. Verify OAuth Client Credentials

Ensure that the OAuth client credentials used in Postman match exactly with those configured in FreePBX. These credentials are usually set up in the FreePBX administration interface.

  • Log in to your FreePBX admin panel.
  • Navigate to the section where OAuth clients are managed. This might be under “Admin” or “Applications,” depending on your FreePBX version.
  • Check the client ID and secret; make sure they are exactly the same in your Postman configuration.

2. Correct Postman Configuration

In Postman, setting up the request for an access token should be done carefully:

  • Set the request type to POST.
  • The URL should be the token endpoint of your FreePBX API (usually something like http(s)://<your-freepbx-server>/admin/api/api/token).
  • In the Body of the request, select x-www-form-urlencoded.
  • Add the following key-value pairs:
    • grant_type: should be set to client_credentials.
    • client_id: your OAuth client ID.
    • client_secret: your OAuth client secret.

3. Check Redirect URI

Make sure that the redirect URI in your OAuth client configuration in FreePBX matches with any URI you’re using in Postman. Sometimes, even if not used, a mismatch can cause issues.

4. FreePBX Configuration

Ensure that your FreePBX instance is properly configured to handle REST API requests:

  • Check that the REST API module is installed and enabled.
  • Ensure that the network configuration allows API access (check firewalls or network settings).

5. Server Response

Carefully examine the response you’re getting from the server:

  • Look for any additional error messages or codes in the response.
  • Check server logs if possible for more detailed error messages.

Also, make sure that there are no network issues or firewalls blocking your request from Postman to your FreePBX server.

On another note, sometimes, simply refreshing the settings or restarting the FreePBX server can resolve unexpected glitches.

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel