Redirect user to a theme preview, bypassing password

Hi. We are developing an embedded plugin for shopify. We want to redirect user from admin page to his own store and show him the preview of how our plugin will work on his page.

idea is :

  1. in shopify user clicks “Preview in My Store”
  2. he is redirected to his store with query params that we need to open preview

Expected: store opens with query params
Actual: if store has a password query params are removed and user is redirected to /password page

In shopify itself when clicking preview (weve checked), its calling the OnlineStorePreviewSessionCreate method that creates token that bypasses the password, but this method is not accessible for plugin developers. Can u plese provide details on how to create the _br token thats used for session auth in shopify admin

I found working solution for my case. Im passing preview_theme_id in url that activates preview mode even if password is prompted before. im storing my query params in metafields of shop.

So when user enters the page im checking the metafields + if we are in preview, and im showing the demo of our app