Skip to content

WebView not opening Remix app webpage as authenticated when navigating from Expo app #3880

Description

@lramosaj

Preliminary Checks

Reproduction

webview opens as unauthenticated in mobile

Publishable key

pk_test_bmF0aXZlLWNvdy01NS5jbGVyay5hY2NvdW50cy5kZXYk

Description

I am working on an Expo app and using Clerk for authentication. I need to open a web view in the mobile app, but the authentication state should be passed from mobile to the web component opened on the web view (Web is Remix). I attempted it like this:

    source={{ uri: url, headers: {
      Authorization: `Bearer ${token}`
    }}}
    sharedCookiesEnabled={true}

But, I am not able to have a successful navigation, since I am unauthenticated when web view is opened. The value
token comes from the getToken of useAuth that I imported from @clerk/clerk-expo"
.

I also tried using it like this:

    source={{ uri: url, headers: {
      Cookies: `${token}`
    }}}
    sharedCookiesEnabled={true}

As a last effort, I tried copying the whole
cookies
body from the script in the network tag from my web app and pasting to the
Cookies
parameter above, but it was not successful. Here is the structure of that value:

  __clerk_db_jwt=...;
  __clerk_db_jwt_2fyn-cby=...; 
  __client_uat_2fyn-cby=...; 
  __client_uat=...; 
  __session_2fyn-cby=...;
  __session=...;
}

This looks like an issue with Clerk, since I suppose that opening a webview as authenticated should be possible.

Environment

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz
    Memory: 3.36 GB / 15.48 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
    pnpm: 9.1.0 - ~/.nvm/versions/node/v20.11.0/bin/pnpm
  Browsers:
    Chrome: 102.0.5005.115

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions