@shopify/csrf-token-fetcher
JavaScript utility function to fetch the CSRF token required to make requests to a Rails server
Last updated 21 days ago by shopify-dep .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @shopify/csrf-token-fetcher 
SYNC missed versions from official npm registry.

@shopify/csrf-token-fetcher

Build Status License: MIT npm version npm bundle size (minified + gzip)

JavaScript utility function to fetch the CSRF token required to make requests to a Rails server

Installation

$ yarn add @shopify/csrf-token-fetcher

API Reference

function getCSRFToken(scope = document)

Retrieve the CSRF token from the meta tag rendered by a Rails server. This token is required in the X-CSRF-Token header for requests to the Rails server.

In the html.erb file:

<%= csrf_meta_tags %>

Example Usage

import getCSRFToken from '@shopify/csrf-token-fetcher';

getCSRFToken();
// → 'token_value'

Current Tags

  • 0.0.9                                ...           latest (21 days ago)

8 Versions

  • 0.0.9                                ...           21 days ago
  • 0.0.8                                ...           a month ago
  • 0.0.7                                ...           3 months ago
  • 0.0.6                                ...           8 months ago
  • 0.0.5                                ...           8 months ago
  • 0.0.4                                ...           8 months ago
  • 0.0.3                                ...           a year ago
  • 0.0.1                                ...           a year ago
Downloads
Today 0
This Week 8
This Month 8
Last Day 0
Last Week 0
Last Month 32
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |