X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/7a98913d0cf74887180aca3520c628a52b0e7071..3ddc80325948aa1f5249c31dd39dcb3c8156d7d5:/app/views/site/id_iframe.html.erb?ds=inline diff --git a/app/views/site/id_iframe.html.erb b/app/views/site/id_iframe.html.erb index 0422446b3..5c061ea3a 100644 --- a/app/views/site/id_iframe.html.erb +++ b/app/views/site/id_iframe.html.erb @@ -16,21 +16,20 @@ 'Please upgrade your browser or use Potlatch 2 to edit the map.'; document.getElementById('id-container').className = 'unsupported'; } else { - var qs = iD.util.stringQs(location.hash); - if (qs.preauth) { - var preauth = JSON.parse(qs.preauth); + var id = iD() + .embed(true) + .imagePath("/assets/iD/img/")<%# Can't use asset_path('id/img/') in production. %> + .preauth({ + <% token = @user.access_token(ID_KEY) %> + url: "<%= request.protocol + request.host_with_port %>", + oauth_consumer_key: "<%= token.client_application.key %>", + oauth_secret: "<%= token.client_application.secret %>", + oauth_token: "<%= token.token %>", + oauth_token_secret: "<%= token.secret %>" + }); - var id = iD() - .embed(true) - .imagePath("/assets/iD/img/"); <%# Can't use asset_path('id/img/') in production. %> - - id.connection() - .url(Object.keys(preauth)[0]) - .keys(preauth); - - d3.select('#id-container') - .call(id.ui()); - } + d3.select('#id-container') + .call(id.ui()); }