OAuth1.0a signature generation
<p>I'm having real difficulty generating the OAuth1.0a signature correctly. Below are the parameters that I used from <a href="http://www.cubrid.org/blog/dev-platform/dancing-with-oauth-understanding-how-authorization-works/" rel="nofollow">here (Request Token)</a></p>

<pre><code>//URL parameters sans-signature
$preSignedParameters = [
     'oauth_callback' =&gt; 'http://example.com/OAuthRequestToken.do',
     'oauth_consumer_key' =&gt; 'WEhGuJZWUasHg',
     'oauth_nonce' =&gt; 'zSs4RFI7lakpADpSsv',
     'oauth_signature_method' =&gt; 'HMAC-SHA1',
     'oauth_timestamp' =&gt; 1330442419,
     'oauth_version' =&gt; '1.0'
];

$signature = $this-&gt;generateSignature(
    CurlHelper::HTTP_GET,
    "http://nid.naver.com/naver.oauth",
    $preSignedParameters
);
</code></pre>

<p>And I sign them with; (code modified for readability sake)</p>

<pre><code>private function generateSignature($method, $url, $parameters)
{
    return base64_encode(
                hash_hmac(
                    'sha1',
                    $this-&gt;generateSignatureString($method, $url, $parameters),
                    $this-&gt;generateSignatureKey(),
                    true
                )
            );
    }
}

private function generateSignatureString($method, $url, $parameters)
{
    //Returns ksort() array
    $parameters = $this-&gt;sortParams($parameters);

    $string = $method
        .'&amp;'.rawurlencode($url)
        .'&amp;'.rawurlencode(http_build_query($parameters, PHP_QUERY_RFC3986));

    return $string;
}

private function generateSignatureKey()
{
    if (!$applicationToken = $this-&gt;getApplicationToken()) {
        $applicationToken = '';
    }

    $key = rawurlencode('WEhGuJZWUasHg').'&amp;'.rawurlencode($applicationToken);

    return $key;
}
</code></pre>

<p>So when I pass in the above parameters...</p>

<p><strong>generateSignatureString()</strong> returns </p>

<pre><code>GET&amp;
http%3A%2F%2Fnid.naver.com%2Fnaver.oauth&amp;
oauth_callback%3Dhttp%253A%252F%252Fexample.com%252FOAuthRequestToken.do%26
oauth_consumer_key%3DWEhGuJZWUasHg%26
oauth_nonce%3DzSs4RFI7lakpADpSsv%26
oauth_signature_method%3DHMAC-SHA1%26
oauth_timestamp%3D1330442419%26
oauth_version%3D1.0
</code></pre>

<p><strong>generateSignatureKey()</strong> returns</p>

<pre><code>WEhGuJZWUasHg&amp;
</code></pre>

<p><strong>generateSignature()</strong> returns</p>

<pre><code>5EqAAGLxoAovkYs+4gS1E4S9l5I=
</code></pre>

<p><strong>Expected signature</strong> (according to linked guide)</p>

<pre><code>wz9+ZO5OLUnTors7HlyaKat1Mo0=
</code></pre>

<p>And of course it goes on to get an "invalid_signature" error from the OAuth provider.</p>

<p>What am I doing wrong???</p>