Giter Site home page Giter Site logo

mvanroon / react-native-axios-jwt Goto Github PK

View Code? Open in Web Editor NEW
32.0 3.0 9.0 190 KB

Axios interceptor to store, transmit, clear and automatically refresh tokens for authentication in a React Native environment

Home Page: https://www.npmjs.com/package/react-native-axios-jwt

JavaScript 1.00% TypeScript 99.00%
react-native axios jwt jwt-token interceptor async-storage

react-native-axios-jwt's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-axios-jwt's Issues

Could not resolve dependency: axios@"~0"

npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/axios
npm ERR!   axios@"^1.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer axios@"~0" from [email protected]
npm ERR! node_modules/react-native-axios-jwt
npm ERR!   react-native-axios-jwt@"^1.7.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/axios
npm ERR!   peer axios@"~0" from [email protected]
npm ERR!   node_modules/react-native-axios-jwt
npm ERR!     react-native-axios-jwt@"^1.7.1" from the root project

How to fix?
This forces the use of --legacy-peer-deps for every installation (

Sending empty request

Changing the issue to the one I currently have :)

I've managed to make it run, kind of. However, login post request is sending empty request, It seems to be this lib specific, but not sure.

  const handleLogin = async (email, password) => {
    const response = await axiosInstance.post('/auth/token/obtain/', {
      email: email,
      password: password,
    });
    await setAuthTokens({
      accessToken: response.data.access_token,
      refreshToken: response.data.refresh_token,
    });
  };

Can't install

npm install [email protected]

npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected]
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

Login State

Hi.
How to get current login state?
There's nothing to do with isLoggedIn function.

Connect with jsx

Any success in using it with libraries like react-navigation and make use of isLoggedIn to conditional render something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.