4 $.ajaxPrefilter(function(options, jqxhr) {
5 if (options.oauth && OSM.oauth_token) {
6 var ohauth = window.ohauth;
7 var url = options.url.replace(/\?$/, "");
9 oauth_consumer_key: OSM.oauth_consumer_key,
10 oauth_token: OSM.oauth_token,
11 oauth_signature_method: "HMAC-SHA1",
12 oauth_timestamp: ohauth.timestamp(),
13 oauth_nonce: ohauth.nonce()
16 params.oauth_signature = ohauth.signature(
17 OSM.oauth_consumer_secret,
18 OSM.oauth_token_secret,
19 ohauth.baseString(options.type, url, $.extend({}, params, jqxhr.data))
22 options.headers = options.headers || {};
23 options.headers.Authorization = "OAuth " + ohauth.authHeader(params);