Search code examples
laravelreact-nativelaravel-passportlaravel-socialite

Integrate Laravel Socialite with React Native Frontend using Passport


I have a Laravel server with socialite and passport. I installed the coderello plugin to have the grant_social type. When I authorize the social, I reply from laravel to the client with a JSON with the social auth token. How can I capture it from my react app so I can use to make API calls? And how should I login with social? Should I use manual redirect with a WebView or should I use the official social's SDKs?


Solution

  • I solved using a view as response that contains a script that calls window.ReactNativeWebView.postMessage and in my React app I use onMessage callback inside the WebView.