API not working on PROD environment (SSL enabled), getting the following error when trying to access the endpoints via oauth

OAuthException Object
(
    [message:protected] => Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
    [string:Exception:private] =>
    [code:protected] => 401
    [file:protected] => <DOCROOT_PATH>/sites/all/modules/oauth_client/oauth_client.module
    [line:protected] => 83
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => <DOCROOT_PATH>/sites/all/modules/oauth_client/oauth_client.module
                    [line] => 83
                    [function] => fetch
                    [class] => OAuth
                    [type] => ->
                    [args] => Array
                        (
                            [0] => <PRODUCTION_SERVER>//profile/node.json
                            [1] => Array
                                (
                                )

                            [2] => POST
                        )

                )

            [1] => Array
                (
                    [function] => oauth_client_page_callback
                    [args] => Array
                        (
                        )

                )

            [2] => Array
                (
                    [file] => <DOCROOT_PATH>/includes/menu.inc
                    [line] => 527
                    [function] => call_user_func_array
                    [args] => Array
                        (
                            [0] => oauth_client_page_callback
                            [1] => Array
                                (
                                )

                        )

                )

            [3] => Array
                (
                    [file] => <DOCROOT_PATH>/index.php
                    [line] => 21
                    [function] => menu_execute_active_handler
                    [args] => Array
                        (
                        )

                )

        )

    [previous:Exception:private] =>
    [lastResponse] => ["Token not found"]
    [debugInfo] => Array
        (
            [sbs] => POST&https%3A%2F%2<DOMAIN>%2F%2Fprofile%2Fnode.json&oauth_consumer_key%<KEY>%26oauth_nonce%<PARAM>.89849805%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1455167746%26oauth_token%<TOKEN>%26oauth_version%3D1.0
            [headers_recv] => HTTP/1.1 401 Unauthorized : Token not found
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Content-Type: application/json
Date: Thu, 11 Feb 2016 05:15:47 GMT
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Server: nginx
Vary: Accept-Encoding
WWW-Authenticate: OAuth realm="<DOMAIN>"
X-AH-Environment: prod
X-Content-Type-Options: nosniff
X-Drupal-Cache: MISS
X-Request-ID: <REQUEST_ID>
Content-Length: 19
Connection: Close
            [body_recv] => ["Token not found"]
        )

    [xdebug_message] =>
OAuthException: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect) in <DOCROOT_PATH>/sites/all/modules/oauth_client/oauth_client.module on line 83

)
CommentFileSizeAuthor
#3 2666666-3.patch598 bytesAnkit Agrawal
#2 2666666-1.patch598 bytesAnkit Agrawal
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ankit Agrawal created an issue. See original summary.

Ankit Agrawal’s picture

FileSize
598 bytes

This patched resolved the issue on Acquia PROD environment.

Ankit Agrawal’s picture

FileSize
598 bytes

Updated the filename with proper comment number.

Ankit Agrawal’s picture

Status: Active » Needs review
SocialNicheGuru’s picture

I got this error:
Notice: Undefined index: HTTP_X_FORWARDED_PROTO in OAuthRequest::from_request() (line 275 of oauth/lib/OAuth.php) which is the line inserted.

I am using apache2 server