# Loopback Interface Redirection Help

**URL:** <https://community.auth0.com/t/loopback-interface-redirection-help/23014>\
**Category:** Get Help\
**Tags:** authorization-code, pkce, localhost\
**Created:** [March 23, 2019, 3:42am UTC](https://community.auth0.com/t/loopback-interface-redirection-help/23014 "2019-03-23T03:42:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tombowers](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tombowers/32/11972_2.png) [@tombowers](https://community.auth0.com/u/tombowers)\
**Post date:** [March 23, 2019, 3:42am UTC](https://community.auth0.com/t/loopback-interface-redirection-help/23014/1 "2019-03-23T03:42:42Z")

</div>

Hi,

I’m implementing authentication for a cross-platform desktop app using [authorization code grant flow with PKCE](https://auth0.com/docs/api-auth/grant/authorization-code-pkce). As confirmed by the Auth0 blog post…

> **[OAuth 2.0 Best Practices for Native Apps](https://auth0.com/blog/oauth-2-best-practices-for-native-apps/)**
>
> The IETF has released Best Current Practice (BCP) for OAuth 2.0 in native apps. Learn about it now.

…it is no longer recommended to use an integrated web browser to perform native authentication. This means I should open the authorize url in the system browser, and that my desktop app must be able to retrieve the authorization code after the external login redirect.

Here’s my problem. Of the available options for obtaining the auth code, ‘Loopback Interface Redirection’ e.g. redirecting to the loopback address, seems to offer the most seamless login experience, but I can’t use it in production as Auth0 doesn’t allow a wildcard port number. If I hardcode a specific port to listen to, I have no guarantee it will be available on the client machine.

Quoting from the ‘[OAuth 2.0 for Native Apps](https://www.rfc-editor.org/rfc/rfc8252.txt)’ spec which Auth0 cites in the blog post…

> The authorization server MUST allow any port to be specified at the  
> time of the request for loopback IP redirect URIs, to accommodate  
> clients that obtain an available ephemeral port from the operating  
> system at the time of the request.

As far as I can tell, Auth0 doesn’t support this, so I have to specify a fixed port in the ‘allowed callbacks’ setting. I can’t specify EVERY ephemeral port number, as there’s around 16000 of them! Neither can I use a custom URI scheme, as this would require my users to elevate the app to admin in order to register the scheme with the OS. It would also require the user to approve the scheme when the redirect happens in their browser, which feels clunky, and they might click ‘no’.

Does anyone know how I can work around this, or if/when Auth0 are planning to implement this?

Thanks

Tom

---

<div class="post-metadata">

**Author:** ![nicolas\_sabena](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nicolas_sabena/32/6064_2.png) [@nicolas\_sabena](https://community.auth0.com/u/nicolas_sabena)\
**Post date:** [March 23, 2019, 10:26pm UTC](https://community.auth0.com/t/loopback-interface-redirection-help/23014/3 "2019-03-23T22:26:51Z")

</div>

Hi @Tom. I was under the impression that the loopback callback URLs accepted an asterisk in the port number, but I couldn’t get it to work. I’ll check with someone from engineering on Monday and I’ll get back to you.

---

<div class="post-metadata">

**Author:** ![nicolas\_sabena](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nicolas_sabena/32/6064_2.png) [@nicolas\_sabena](https://community.auth0.com/u/nicolas_sabena)\
**Post date:** [March 25, 2019, 5:40pm UTC](https://community.auth0.com/t/loopback-interface-redirection-help/23014/4 "2019-03-25T17:40:43Z")

</div>

Hi again @Tom.  
Unfortunately, we don’t support wildcards for the port in loopback callback URLs. You are correct in that this should be supported, so I’ll add a feature request on your behalf at [Auth0: Secure access for everyone. But not just anyone.](https://auth0.com/feedback).  
I’ll link directly to this topic, as your user case and explanation are perfectly clear.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 30, 2019, 1:00pm UTC](https://community.auth0.com/t/loopback-interface-redirection-help/23014/5 "2019-08-30T13:00:11Z")

</div>


