Authentication in React Native

Trying to get basic password authentication working in React Native. Thus far I’ve studied the accounts-password package a bit, and think I’ve found the methods I need to call from my React Native forms to create a user or trigger a login.

I’m confused about how to persist logins using just React Native or ddp-client. Obviously I don’t want users to have to type in their password again and again. So, when they successfully authenticate, what piece of data from ddp-client do I need to store so I’m not persisting their username and password locally? How do I then go from that token to an authenticated DDP session?

Also, something just occurred to me. Meteor’s docs claim that passwords aren’t sent unencrypted over the wire. Do I need to somehow encrypt the passwords client-side before calling the methods that accounts-password exports?

Does anyone have a good example of authentication in React Native or, I suppose, of authentication using ddp-client? I’ve seen a few React Native apps but haven’t yet found one that supports a) simple user creation and b) user/password authentication.

Thanks.

This, my friend, is what you’re looking for:

Store the login token, then use it to log back in.

1 Like

Very nice! Thanks, I’ll give that a shot.