I was trying to retrieve an access_token by calling the
Code:
/oauth/v1/access_token
endpoint.
Until this call everything went fine and as expected. I got the oauth_token and oauth_verifier and added them to my authorization header. But unfortunately the server responded with a
Code:
500 - Internal Server Error
and the following message:
Code:
{"error":{"message":"An exception occurred while executing u0027INSERT INTO oauth1_access_tokens (token, secret, expires_at, consumer_id, user_id) VALUES (?, ?, ?, ?, ?)u0027 with params [u002243szk469bdc0cw4cs4c88cg4og8w0w884w8gg04oows0gsw4kwu0022, u00225cyqr1e1e3s48ksgs4wckw4cskgk8gs8osssggko8g0ookc0ocu0022, null, 1, null]:nnSQLSTATE[23000]: Integrity constraint violation: 1048 Column u0027user_idu0027 cannot be null","code":500}}
It seems that there's a problem with my user_id. Did I miss something important or is this a Bug?
I was trying to retrieve an access_token by calling the /oauth/v1/access_token endpoint.
Until this call everything went fine and as expected. I got the oauth_token and oauth_verifier and added them to my authorization header. But unfortunately the server responded with a 500 - Internal Server Error and the following message:
{"error":{"message":"An exception occurred while executing u0027INSERT INTO oauth1_access_tokens (token, secret, expires_at, consumer_id, user_id) VALUES (?, ?, ?, ?, ?)u0027 with params [u002243szk469bdc0cw4cs4c88cg4og8w0w884w8gg04oows0gsw4kwu0022, u00225cyqr1e1e3s48ksgs4wckw4cskgk8gs8osssggko8g0ookc0ocu0022, null, 1, null]:nnSQLSTATE[23000]: Integrity constraint violation: 1048 Column u0027user_idu0027 cannot be null","code":500}}
It seems that there’s a problem with my user_id. Did I miss something important or is this a Bug?
Here is what Mautic System Info is telling me about the failure described above:
[2016-05-24 07:38:15] mautic.ERROR: Fatal: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. - in file Unknown - at line 0 [] []
[2016-05-24 07:38:42] mautic.ERROR: Uncaught PHP Exception SymfonyComponentHttpKernelExceptionHttpException: "token_rejected" at /var/www/vhosts/domain.com/domain.com/vendor/willdurand/oauth-server-bundle/Service/OAuthServerService.php line 74 {"exception":"[object] (Symfony\Component\HttpKernel\Exception\HttpException(code: 0): token_rejected at /var/www/vhosts/domain.com/domain.com/vendor/willdurand/oauth-server-bundle/Service/OAuthServerService.php:74)"} []
[2016-05-24 07:38:42] mautic.ERROR: Fatal: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. - in file Unknown - at line 0 [] []
[2016-05-24 07:39:04] mautic.ERROR: Fatal: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. - in file Unknown - at line 0 [] []
[2016-05-24 07:40:23] mautic.ERROR: PHP Error: Argument 2 passed to BazingaOAuthServerBundleServiceOAuthServerService::createAccessToken() must implement interface SymfonyComponentSecurityCoreUserUserInterface, null given, called in /var/www/vhosts/domain.com/vendor/willdurand/oauth-server-bundle/Service/OAuthServerService.php on line 220 and defined - in file /var/www/vhosts/domain.com/domain.com/vendor/willdurand/oauth-server-bundle/Service/OAuthServerService.php - at line 135 [] []
[2016-05-24 07:40:23] mautic.ERROR: PHP Error: Argument 2 passed to BazingaOAuthServerBundleModelProviderTokenProvider::createAccessToken() must implement interface SymfonyComponentSecurityCoreUserUserInterface, null given, called in /var/www/vhosts/domain.com/domain.com/vendor/willdurand/oauth-server-bundle/Service/OAuthServerService.php on line 139 and defined - in file /var/www/vhosts/domain.com/domain.com/vendor/willdurand/oauth-server-bundle/Model/Provider/TokenProvider.php - at line 103 [] []
[2016-05-24 07:40:23] mautic.ERROR: PHP Error: Argument 1 passed to MauticApiBundleEntityoAuth1AccessToken::setUser() must implement interface SymfonyComponentSecurityCoreUserUserInterface, null given, called in /var/www/vhosts/domain.com/domain.com/vendor/willdurand/oauth-server-bundle/Model/Provider/TokenProvider.php on line 112 and defined - in file /var/www/vhosts/domain.com/domain.com/app/bundles/ApiBundle/Entity/oAuth1/AccessToken.php - at line 187 [] []
[2016-05-24 07:40:23] mautic.CRITICAL: Uncaught PHP Exception DoctrineDBALDBALException: "An exception occurred while executing 'INSERT INTO oauth1_access_tokens (token, secret, expires_at, consumer_id, user_id) VALUES (?, ?, ?, ?, ?)' with params ["2z79nos8soisko888s00o08kw0g8wkgkw8oswg8wckgoo8gk84", "avgawsiswfsws4o040w0c8888gwksw0c8w4o44og08kogg0ws", null, 1, null]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null" at /var/www/vhosts/domain.com/domain.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 91 {"exception":"[object] (Doctrine\DBAL\DBALException(code: 0): An exception occurred while executing 'INSERT INTO oauth1_access_tokens (token, secret, expires_at, consumer_id, user_id) VALUES (?, ?, ?, ?, ?)' with params ["2z79nos8soisko888s00o08kw0g8wkgkw8oswg8wckgoo8gk84", "avgawsiswfsws4o040w0c8888gwksw0c8w4o44og08kogg0ws", null, 1, null]:nnSQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null at /var/www/vhosts/domain.com/domain.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null at /var/www/vhosts/domain.com/domain.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:165)"} []
[2016-05-24 07:40:23] mautic.ERROR: Fatal: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. - in file Unknown - at line 0 [] []