'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>