X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/77de5063128440bd88623f634c522b8933770f2e..c9893e186b32bfd8e8ee8f00e78258387f4aac9c:/app/assets/javascripts/oauth.js diff --git a/app/assets/javascripts/oauth.js b/app/assets/javascripts/oauth.js index aac63f243..98ce302e1 100644 --- a/app/assets/javascripts/oauth.js +++ b/app/assets/javascripts/oauth.js @@ -1,6 +1,12 @@ //= require ohauth $(document).ready(function () { + function makeAbsolute(url) { + var a = document.createElement('a'); + a.href = url; + return a.href; + } + if (OSM.oauth_token) { var headerGenerator = window.ohauth.headerGenerator({ consumer_key: OSM.oauth_consumer_key, @@ -12,7 +18,7 @@ $(document).ready(function () { $.ajaxPrefilter(function(options, jqxhr) { if (options.oauth) { options.headers = options.headers || {}; - options.headers.Authorization = headerGenerator(options.type, options.url, jqxhr.data); + options.headers.Authorization = headerGenerator(options.type, makeAbsolute(options.url), jqxhr.data); } }); }