Akeneo: Parameter \"client_id\" is missing or does not match any client, or secret is invalid

When trying to generate an access token base on step 2 of this guide https://api.akeneo.com/getting-started.html

I get the following error after running the following POST request via curl or the akeneo Postman.

curl -X POST http://my-favorite-pim.com/api/oauth/v1/token \
    -H "Content-Type: application/json" \
    -H "Authorization: Basic MY_BASE64_CLIENT_ID_AND_SECRET" \
    -d '{
        "grant_type": "password",
        "username": "MY_API_USERNAME",
        "password": "MY_API_PASSWORD",
    }'
{"code":422,"message":"Parameter \"client_id\" is missing or does not match any client, or secret is invalid"}

Hi,

This looks like an issue with the application, I advise you to ask in the Akeneo Support Forums.

https://www.akeneo.com/forums/

Hope it helps.

Best regards,

Javier J. Salmerón


Was my answer helpful? Click on :heart:

Using Akeneo version 2.1.4 hosted on AWS, I’m having the exact same issue as the original poster. A 422 error code is generated when I try authenticate with Akeneo’s web API on my Bitnami Akeneo instance.

I tested the API on Akeneo’s demo installation: demo.akeneo.com and I can successfully authenticate (token generated). It’s only with my Bitnami version that I’m receiving the 422 error, so I don’t believe it’s a problem with Akeneo.

Error:
{
    "code": 422,
    "message": "Parameter \"client_id\" is missing or does not match any client, or secret is invalid"
}

I’ve spent at least 5 hours reading Bitnami and Akeneo documentation trying to diagnose the issue.
https://api.akeneo.com/documentation/troubleshooting.html#missing-client-id

Any help is greatly appreciated.

I finally found the solution to this issue. Apache, by default, removes the authorization parameter for security reasons. This can be changed by editing this file:

/opt/bitnami/apache2/conf/bitnami/bitnami.conf

This is what needs to be added in two places:

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

This is a copy of my edited bitnami.conf file which includes the necessary changes:

# Default Virtual Host configuration.

<IfVersion < 2.3 >
  NameVirtualHost *:80
  NameVirtualHost *:443
</IfVersion>

<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny                          
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</VirtualHost>

# Default SSL Virtual Host configuration.

<IfModule !ssl_module>
  LoadModule ssl_module modules/mod_ssl.so
</IfModule>

Listen 443
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4"
SSLPassPhraseDialog  builtin
SSLSessionCache "shmcb:/opt/bitnami/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

<VirtualHost _default_:443>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  SSLEngine on
SSLCertificateFile "/opt/bitnami/apache2/conf/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apache2/conf/server.key"
            
  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny                          
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html
        
  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</VirtualHost>

# Bitnami applications that uses virtual host configuration
Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf"
3 Likes

Hi,

We are glad that you were able to fix the issue. We are marking the previous answer as “Solution” and this topic as “Solved”.
If you have any other questions, please do not hesitate to let us know. Feel free to create a new topic referencing to this one if necessary.

Best regards,
Carlos R. Hernández