Authsession Browser Auth

Hello All,

I have a problem with the Authentication methods. Firstly I used A Laravel API with Airlock to handle auth calls, the login was in RN. But the second screen with my Apptabs have WebViews loaded and I can’t share the token so the user will see again a login screen.

What I am doing now is using Laravel pasport so I can use the expo Authsession so I can do a browser based authentication. The authentication is working but how can I pass the cookies/sessions or tokens to the WebViews in the RN app? Do I need to use custom headers? what is the solution?

Below is the authsessioin that opens a browsed based auth and it returns to the app but in the app you need to login again because I need a way to pass the info

  const _handlePressButtonAsync = async () => {

    let redirectUrl = AuthSession.getRedirectUrl();
    let result = await AuthSession.startAsync(
          `https://urenstaat-laravel.test/oauth/authorize?response_type=code`  +
          `&client_id=3` +

Below is the WebView that I load

        uri: "http://urenstaat-laravel.test/registration",
      style={{ marginTop: -130 }}

I am using Expo SDK v36.0.0 and the app is for iOS and Android


First read this one: AuthSession - Expo Documentation

Then, make sure you use the expo WebBrowser to make the initial requests.

Finally, follow: react-native-webview/ at master · react-native-webview/react-native-webview · GitHub to inject the cookies (the one that has your session/token) into the webview :slightly_smiling_face: (edited)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.