]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/id_iframe.html.erb
Update iD; clean up OAuth configuration
[rails.git] / app / views / site / id_iframe.html.erb
index 0422446b34390199cc56711fddbaf3db702ae885..5c061ea3a40e42094bae78834e921a47d1cc17eb 100644 (file)
       'Please upgrade your browser or use Potlatch 2 to edit the map.';
     document.getElementById('id-container').className = 'unsupported';
   } else {
       '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());
   }
 </script>
 </body>
   }
 </script>
 </body>