Open ajai-jayakumar opened 6 years ago
I think you can. Your mobile app would probably be talking to the same back-end server, which uses passport.
passport requires ‘http’ and ‘crypto’ packages but these packages are deprecated in npm. These packages only contains a single Readme file. When you don’t install the packages RN throws ‘package not found’ exception. When you install RN throws ‘package found but index file not found’ exception. There is a reverse engineering workaround but I couldn’t apply the method successfully. I will try again in a few days, I will share the result.
Any update on this @suphero ?
im facing the same issue, did you figure it out @suphero
TL;DR: Maybe you can but you shouldn't use it.
It's been a long time since my answer and I obviously couldn't keep my word. I don't remember what I had in mind when I said "reverse engineering workaround".
I've rechecked the case, and it didn't work as before. The issue is:
The package at "node_modules/passport/lib/middleware/authenticate.js" attempted to import the Node standard library module "http". It failed because the native React runtime does not include the Node standard library.
I checked the authenticate.js file, It doesn't look like it needs the http module much because it only uses http.STATUS_CODES. One may use passport.js with React Native by removing the http reference and updating the usage (it may be the workaround).
Coming to the original question, maybe there is a way to use but you shouldn't use passport with React Native because:
Hi, I am currently using Angular Fullstack Generator for my web application, now I am planning to create a mobile application using React Native. Since my current application uses the passport for authentication. Is it possible to use for react native as well?