Skip to content

redirect_uri incorrect in auth0.onLoad(). #409

Open
@jwalton

Description

@jwalton

Checklist

Description

When I login with:

_auth0 = Auth0Web(domain, clientId);
_auth0.loginWithRedirect(
  redirectUrl: 'http://localhost:8080/callback",
);

_auth0.onLoad().then((final credentials) { ... }

This works as expected. But, if I reload the page, the onLoad() attempts to do a "silent authentication" to recover my credentials and this fails. The onLoad() results in a network request being sent that looks like:

https://xxxx.auth0.com/authorize?...&redirect_uri=https%3A%2F%2Flocalhost%3A8080&...

And this fails, with the logs reporting "Failed Silent Auth: Callback URL mismatch. https://localhost:8080 is not in the list of allowed callback URLs."

This is correct: that URL is not in my list of allowed callback URLs, and nor do I want it to be. But, onLoad() doesn't seem to accept a redirectUrl as a parameter.

You can work around this with:

_auth0.onLoad(parameters: {'redirect_uri': _redirectUrl}).then((final credentials) {...})

But, yuck. It would be much nicer if the Auth0Web constructor accepted an optional redirectUri parameter like the js version does.

Reproduction

n/a

Additional context

No response

auth0_flutter version

1.5.0

Flutter version

3.20.0-7.0.pre.17

Platform

Web

Platform version(s)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestA feature has been asked for or suggested by the communityweb

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions