Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usage with feathersjs authentication module on react-native #16

Closed
ramsestom opened this issue Aug 3, 2016 · 2 comments
Closed

usage with feathersjs authentication module on react-native #16

ramsestom opened this issue Aug 3, 2016 · 2 comments

Comments

@ramsestom
Copy link

@ramsestom ramsestom commented Aug 3, 2016

Hi

How could I use AsyncStorage with the feathersjs authentication service on react-native.
I used to do:

this.app = feathers()
      .configure(socketio(socket))
      .configure(hooks())
      // Use AsyncStorage to store our login toke
      .configure(authentication({
        storage: AsyncStorage
      }));
  }

but it doesn't work anymore with RN 0.30 and latest feathers client api

I tried

import localstorage from 'feathers-localstorage';
this.app = feathers()
      .configure(socketio(socket))
      .configure(hooks())
      .use('/auth', localstorage({ storage: AsyncStorage }));

but it doesn't work either (return an error: _this2.app.authenticate is not a function)

@daffl

This comment has been minimized.

Copy link
Member

@daffl daffl commented Aug 3, 2016

feathers-localstorage is a service wrapper for Async- or Localstorage and not used in the authentication module (anymore). Are you getting any errors using

const app = feathers()
      .configure(socketio(socket))
      .configure(hooks())
      // Use AsyncStorage to store our login toke
      .configure(authentication({
        storage: AsyncStorage
      }));

How are you using this setup?

@ramsestom

This comment has been minimized.

Copy link
Author

@ramsestom ramsestom commented Aug 3, 2016

No I don't get any error using this. But it doesn't seem to work anymore as the authentication is not stored (I have to re-authenticate each time I restart the app whereas with previous version of react native it was working as expected and the authentication token was correctly stored)

EDIT:I traced back the error and it was a wrong routing in my app (forgot to change the name of an action). So the authentication AsyncStorage is working as expected. Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.