# Capacitor redirect URL issue

**URL:** <https://forum.ionicframework.com/t/capacitor-redirect-url-issue/206420>\
**Category:** Capacitor\
**Created:** [March 12, 2021, 3:37pm UTC](https://forum.ionicframework.com/t/capacitor-redirect-url-issue/206420 "2021-03-12T15:37:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brassier](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@brassier](https://forum.ionicframework.com/u/brassier)\
**Post date:** [March 12, 2021, 3:37pm UTC](https://forum.ionicframework.com/t/capacitor-redirect-url-issue/206420/1 "2021-03-12T15:37:07Z")

</div>

I have an auth workflow which opens a browser, then redirects back to the app to finish the login. This works well when opening a browser window outside the app, and using a custom URL scheme to redirect back to the app.

I’d like to do this with an in-browser app. Unfortunately the browser window hangs and doesn’t redirect back to the app. I am using the `server.allowNavigation` setting to get Capacitor to open the browser in-app.

Should a custom URL redirect back to the app when opened in-app? Or does an in-app URL need a different URL to get back to the main app window?

---

<div class="post-metadata">

**Author:** ![brassier](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@brassier](https://forum.ionicframework.com/u/brassier)\
**Post date:** [March 19, 2021, 12:53pm UTC](https://forum.ionicframework.com/t/capacitor-redirect-url-issue/206420/2 "2021-03-19T12:53:32Z")

</div>

I figured this out. I realized that my problem was the unexpected way to import the Capacitor Browser plugin. Once I imported like the [Docs said](https://capacitorjs.com/docs/apis/browser), the in-app browser window worked great, using a custom URL scheme to redirect back to the app. I also removed these URLs from the `allowNavigation` setting (as in my case they are external and not controlled by us).

```auto
import { Plugins } from '@capacitor/core';    
const { Browser } = Plugins;
...
await Browser.open({ url: 'http://capacitorjs.com/' });

```
