All Projects → 3846masa → Axios Cookiejar Support

3846masa / Axios Cookiejar Support

Licence: mit
Add tough-cookie support to axios.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Axios Cookiejar Support

Snapshot
SnapShot is Gallery created using React Hooks, Context API and React Router. The Routes were setup for four default pages and a search page. Also the images were displayed using the Flickr API and Axios to fetch data.
Stars: ✭ 134 (-20.71%)
Mutual labels:  axios
Vue Webpack Config
Koa2、Webpack、Vue、React、Node
Stars: ✭ 151 (-10.65%)
Mutual labels:  axios
Wechat Request
🚀⚡️基于Promise实现微信小程序http请求,轻便,小巧,api友好,功能丰富
Stars: ✭ 156 (-7.69%)
Mutual labels:  axios
Swagger Axios Codegen
swagger client to use axios and typescript
Stars: ✭ 143 (-15.38%)
Mutual labels:  axios
Vue Shop
VUE移动小商城
Stars: ✭ 148 (-12.43%)
Mutual labels:  axios
Dunglasangularcsrfbundle
Automatic CSRF protection for JavaScript apps using a Symfony API
Stars: ✭ 152 (-10.06%)
Mutual labels:  axios
Webapiclientgen
Strongly Typed Client API Generators generate strongly typed client APIs in C# .NET and in TypeScript for jQuery and Angular 2+ from ASP.NET Web API and .NET Core Web API
Stars: ✭ 134 (-20.71%)
Mutual labels:  axios
Ecommerce Reactjs
Full stack ecommerce online store application
Stars: ✭ 164 (-2.96%)
Mutual labels:  axios
Vue Axios
A small wrapper for integrating axios to Vuejs
Stars: ✭ 1,887 (+1016.57%)
Mutual labels:  axios
Mande
600 bytes convenient and modern wrapper around fetch
Stars: ✭ 154 (-8.88%)
Mutual labels:  axios
Vue Cli Multi Page
基于vue-cli模板的多页面多路由项目,一个PC端页面入口,一个移动端页面入口,且有各自的路由, vue+webpack+vue-router+vuex+mock+axios
Stars: ✭ 145 (-14.2%)
Mutual labels:  axios
Swagger Vue
Swagger to JS & Vue & Axios Codegen
Stars: ✭ 146 (-13.61%)
Mutual labels:  axios
Vue Admin Manager
整合 vue,element,echarts,video,bootstrap(AdminLTE),admin等,搭建的后台管理系统
Stars: ✭ 153 (-9.47%)
Mutual labels:  axios
Spring Boot Vuejs
Example project showing how to build a Spring Boot App providing a GUI with Vue.js
Stars: ✭ 1,818 (+975.74%)
Mutual labels:  axios
Github Ranking
🔍GitHub不同语言热门项目排行,Vue.js做页面展示
Stars: ✭ 160 (-5.33%)
Mutual labels:  axios
Vue Element Quick Start
Vue2, Vuex 3, Vue Router 3, Element-ui and Typescript SPA project quick start kit(Vue element ui 快速开始脚手架)
Stars: ✭ 135 (-20.12%)
Mutual labels:  axios
Vue.netcore
.NetCore+Vue2/Vue3+Element plus,前后端分离,不一样的快速开发框架;提供Vue2、Vue3版本,。http://www.volcore.xyz/
Stars: ✭ 2,338 (+1283.43%)
Mutual labels:  axios
Openapi Client Axios
JavaScript client library for consuming OpenAPI-enabled APIs with axios
Stars: ✭ 168 (-0.59%)
Mutual labels:  axios
Spotify Clone Client
A ReactJS clone application of the popular Spotify music streaming service. This application utilizes the Spotify API and the Spotify Web Playback SDK
Stars: ✭ 162 (-4.14%)
Mutual labels:  axios
React Axios
Axios Components for React with child function callback
Stars: ✭ 153 (-9.47%)
Mutual labels:  axios

axios-cookiejar-support

Add tough-cookie support to axios.


NPM LICENSE CircleCI

dependencies peerdependencies devdependencies

Install

$ npm i axios tough-cookie axios-cookiejar-support

-- OR --

$ npm i axios tough-cookie @3846masa/axios-cookiejar-support # Same as above

TypeScript

If you want to use it with TypeScript, add @types/tough-cookie.

npm i @types/tough-cookie

Usage

const axios = require('axios').default;
const axiosCookieJarSupport = require('axios-cookiejar-support').default;
const tough = require('tough-cookie');

axiosCookieJarSupport(axios);

const cookieJar = new tough.CookieJar();

axios
  .get('https://google.com', {
    jar: cookieJar, // tough.CookieJar or boolean
    withCredentials: true, // If true, send cookie stored in jar
  })
  .then(() => {
    console.log(cookieJar);
  });

See examples.

Notice: Set default cookiejar

[email protected]>=0.19.0 cannot assign defaults.jar via axios.create() before wrapping instance. When you want to set defaults.jar, please set directly after wrapping instance.

const axios = require('axios').default;
const axiosCookieJarSupport = require('axios-cookiejar-support').default;
const tough = require('tough-cookie');

const instance = axios.create({
  // WARNING: This value will be ignored.
  jar: new tough.CookieJar(),
});

// Set directly after wrapping instance.
axiosCookieJarSupport(instance);
instance.defaults.jar = new tough.CookieJar();

Extended Request Config

c.f.) https://github.com/mzabriskie/axios#request-config

{
  // `jar` is tough.CookieJar instance or boolean.
  // If true, axios create CookieJar automatically.
  jar: undefined, // default

  // Silently ignore things like parse cookie errors and invalid domains.
  // See also https://github.com/salesforce/tough-cookie
  ignoreCookieErrors: false // default

  // **IMPORTANT**
  // If false, axios DONOT send cookies from cookiejar.
  withCredentials: false // default
}

Browser

Running on browser, this library becomes noop (config.jar might be ignored).

Contribution

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

LICENSE

MIT License

Author

3846masa icon 3846masa


Donate

Paypal.me (Onetime donate)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].