<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Don't think it is that, as other OAuth clients were working fine and also the wiki example works; in fact I have got a complete OAuth flow now working, using the documented method on the wiki using the 'request' package, but just thought I'd try something else
as that was deprecated. <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Will try one or two other packages and see if they work.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Nick<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Mateusz Konieczny via dev <dev@openstreetmap.org><br>
<b>Sent:</b> 16 July 2020 17:00<br>
<b>Cc:</b> dev@openstreetmap.org <dev@openstreetmap.org><br>
<b>Subject:</b> Re: [OSM-dev] OAuth difficulties from node.js client</font>
<div> </div>
</div>
<div>
<div>Osm website had sone downtime,<br>
</div>
<div>maybe your code is ok?</div>
<div><br>
</div>
<div><br>
</div>
<div>16 Jul 2020, 17:04 by nick.whitelegg@solent.ac.uk:<br>
</div>
<blockquote class="x_tutanota_quote" style="border-left:1px solid #93A3B8; padding-left:10px; margin-left:5px">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Hello everyone,</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Realise this might be a difficult one, but posting it here in case anyone's encountered similar problems or if anyone can obviously see what's wrong with the request (see below).</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>I'm trying to connect to the OSM OAuth API request_token endpoint from a node.js based client.</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>If I use the recommended example on the wiki for node.js, it works correctly (I get a token and a secret back), _however_ the 'request' module is now deprecated so probably not the best thing to use, even though it handles oauth automatically.</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>I found an alternative module which generates the correct parameters to send to the request token endpoint at:</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><a id="LPlnk425586" href="https://www.npmjs.com/package/oauth-1.0a" rel="noopener noreferrer" target="_blank">https://www.npmjs.com/package/oauth-1.0a</a></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>and it generated parameters which look vaguely sensible:</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div><span>{ oauth_consumer_key: 'EcdM735JygrmO42fzw8SIfbFUMDy1ShVY5bBnefn',<br>
</span></div>
<div> oauth_nonce: 'cNvPEgdgjvQWX5FgS56XkyLaMhQNggmh',<br>
</div>
<div> oauth_signature_method: 'HMAC-SHA1',<br>
</div>
<div> oauth_timestamp: 1594910535,<br>
</div>
<div> oauth_version: '1.0',<br>
</div>
<div> oauth_callback: 'http://localhost/app/',<br>
</div>
<div> oauth_signature: 'WuYA7G8s4qPCht+cF7t7FpTP0ck=' }<br>
</div>
<div><span></span><br>
</div>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
However if I send that to the request_token endpoint (using node-fetch) I get a 500 error.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Fiurthermore, if I use curl to send the same data to the endpoint, I also get a 500:<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
curl --data "oauth_consumer_key=EcdM735JygrmO42fzw8SIfbFUMDy1ShVY5bBnefn&oauth_nonce=cNvPEgdgjvQWX5FgS56XkyLaMhQNggmh&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1594910535&oauth_version=1.0&oauth_callback=http%3A%2F%2Flocalhost%2Fapp%2F&oauth_signature=WuYA7G8s4qPCht%2BcF7t7FpTP0ck%3D"
<a id="LPNoLP754275" href="https://www.openstreetmap.org/oauth/request_token" rel="noopener noreferrer" target="_blank">
https://www.openstreetmap.org/oauth/request_token</a><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I'm guessing something's wrong with the signing process. I used the examples given in the oauth-1.0a documentation to generate the parameters.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I'm surprised I'm getting a 500 rather than say a 400.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks,<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Nick<br>
</div>
<div id="x_Signature">
<div>
<div dir="ltr" id="x_divtagdefaultwrapper" style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</body>
</html>