@shopify/csrf-token-fetcher
JavaScript utility function to fetch the CSRF token required to make requests to a Rails server
Last updated 4 months 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.11                                ...           latest (4 months ago)

10 Versions

  • 0.0.11                                ...           4 months ago
  • 0.0.10                                ...           5 months ago
  • 0.0.9                                ...           6 months ago
  • 0.0.8                                ...           6 months ago
  • 0.0.7                                ...           9 months ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.1                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |