Skip to content

About

No description, website, or topics provided.

Resources

Stars

22 stars

Watchers

1 watching

Forks

Latest commit

 

History

46 Commits

Folders and files

Repository files navigation

About

This package fits a very specific use case. Its purpose is to help keep track of new tokens everytime a request is made. It works by capturing the axios response and hot swapping tokens if new tokens have come back from the server. On an authenticated request, tokens are destroyed on signout and tokens are rehydrated on a validation event.

  • You are using devise token authentication
  • You are using axios

Installation

npm install devise-axios

import { initMiddleware } from 'devise-axios'

initMiddleware()

You can also change the default auth url and options

  //defaults
  //{
  //  authPrefix: '/api/auth',
  //  signOut: '/sign_out',
  //  validate: '/validate_token',
  //}

  const options = { authPrefix: '/auth' }
  initMiddleware(options)

This works with ReactNative as well. (What?)

import { AsyncStorage } from 'react-native'
import initMiddleware from 'devise-axios'

initMiddleware({ storage: AsyncStorage })

About

No description, website, or topics provided.

Resources

Stars

22 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages