Help on how to get osm api token with OAuth

Hello to all of you

I am trying to get the OAuth process to work by looking at the documentation on this topic in order to get the osm api token.

I am doing it through a nodejs project.

I have already registered the OAuth application from the osm page and introduced all the necessary data to make it work, but when I make the request I get an error 500.

I have followed the instructions in this link of the osm documentation to make my code —> OAuth Server side Node.js examples - OpenStreetMap Wiki

I leave my code in case you can help me, I have the doubt if the post request to that osm url is actually working or not.

Thank you very much!

const request = require(‘request’);
const qs = require(“querystring”)

const getOAuthToken = async (req, res) => {{
url: “”,
oauth: {
callback: “myData”, // Supply a callback url. OSM uses the callback url later to return the key data to your application/website.
consumer_key: “myData”, // Consumer key and secret are given to the developer after registering the application on the official OSM site.
consumer_secret: “myData”,


}, (err, rs, body) => {
var bodyObject = qs.parse(body); // You can use the querystring package (const qs = require(“querystring”) :wink: to parse the data to a javascript object.
req.session.oauth_token = bodyObject.oauth_token; // Put the token and token secret in the session of this user.
req.session.oauth_token_secret = bodyObject.oauth_token_secret;
res.send(“OpenStreetMap” + bodyObject.oauth_token); // This URL is used by the user to authorize. Send it to the client so that the client can use it. You could open a popup window or new tab with this URL so that the user can authorize on the official OSM site.

module.exports = {


Why not use GitHub - osmlab/osm-auth: Easy authentication for OpenStreetMap over OAuth2.0 ?