Login in solid pods with react-native

I am building a react-native app that is going to use the pods and the solid project. But how are we able to integrate a login with Solid project in this application?
I tried different ways using the library of solid-node-client, but this does not work properly with react-native, it causes some errors at compile time.
Is there some librarty / way to do this?

@uo269570 I’m the author of solid-node-client. Could you share the errors you got?I’ve never used react-native but would like to help get solid-node-client working with it, so let me know how I can help.


There is some kind of problem using the library fs with react-native. I don’t know if there are going to appear more problems when this is solved.

Okay, the problem is importing fs. You can get around that by using @inrupt/solid-client-authn-node instead of solid-node-client. This will take away your ability to access files on your device as if they were in a Pod. If you need that feature, you can use Solid Rest - the part of solid-node-client that interacts with the local file system though you will probably have to write a plugin for your device. Feel free to ping me if you go that route and have questions.

@jeffz
So i tried to use the package you mentioned, and some errors pops when i login. It seems like some libraries are missing or incompatible. Do you know what should i do?
And another question: what is the refreshToken of the login?
This is the error i mentioned:

It looks to me like your error is related to Inrupt’s solid-client-authn-node. Perhaps @Vincent can help.

solid-client-authn-node is not explicitly tested on React Native (yet), so there are no guarantees that it might work. That said, the error message looks similar to this issue, so the suggested workaround (adding the events npm package) might work for you as well?

@Vincent
I did what you said but a similar error ocurred, so i installed all the modules mentioned on the error till the module crypto, this one brings this error:


re-installing it or doing audit-fix doesn’t work. I guess it is incomplatible.

Unfortunately I don’t have experience with React Native so can’t provide an informed guess, but I know that in the browser the required polyfill is called crypto-browserify, so possibly React Native needs a different one as well. A web search for crypto module react native seems to turn up some further suggestions that might be helpful. Good luck!

I am also currently working on a react-native app and I run into the same issues. Is there already some kind of best-practice to work with react-native?

Or have you found a solution @Pascual?

I haven’t tried it myself, but coincidentally I saw a tweet by @jaxoncreed about releasing an auth library for React Native:

3 Likes

Hi everyone.

I am also currently working on a react-native app with solid pod. But I am stuck on authenticating mobile using Android. I have imported the packages @inrupt/solid-client and @inrupt/solid-ui-react. I know it works in just react, but I’ve tried those packages for react-native but I can’t make it.

Is there any package available for authenticating react-native apps? What about this package(@inrupt/solid-client-authn-browser)?

@wahed yeah, at present we don’t officially support react-native.

A quick search suggests maybe this might hold the answer: javascript - Unable to resolve module "events" React-Native - Stack Overflow

There is also a fork of inrupt/solid-client-authn-js that aims to add react-native support, but I don’t have the link handy, and it was, last I looked at it, quite out of date. React-native is really it’s own unique runtime that needs to be targeted and tested against, unfortunately.

1 Like

@wahed actually, it was linked just above: Login in solid pods with react-native - #12 by Vincent

Thank you @ThisIsMissEm