-//= require ohauth
-
$(document).ready(function () {
- if (OSM.oauth_token) {
- var headerGenerator = window.ohauth.headerGenerator({
- consumer_key: OSM.oauth_consumer_key,
- consumer_secret: OSM.oauth_consumer_secret,
- token: OSM.oauth_token,
- token_secret: OSM.oauth_token_secret
- });
+ var application_data = $("head").data();
- $.ajaxPrefilter(function(options, jqxhr) {
+ if (application_data.oauthToken) {
+ $.ajaxPrefilter(function (options) {
if (options.oauth) {
options.headers = options.headers || {};
- options.headers.Authorization = headerGenerator(options.type, options.url, jqxhr.data);
+ options.headers.Authorization = "Bearer " + application_data.oauthToken;
}
});
}