Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add access_token in backbone.js

In my REST server, it's requiring the access_token to be present in every request. i.e. in POSTing data, access_token needs to be submitted together with the attributes.

How do I configure backbone.js to add access_token to every GET, PUT, POST and DELETE request?

Thanks.

like image 745
Mikko Avatar asked Dec 07 '12 12:12

Mikko


1 Answers

Okay, I think I found a way how to do it in jQuery.

$.ajaxSetup (
   {
      data: { access_token: 'my_access_token' }
   }
);
like image 77
Mikko Avatar answered Sep 21 '22 06:09

Mikko