Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration for redirect_uri not being used during authentication flow for Apple Provider #249

Open
dionridley opened this issue Mar 11, 2024 · 0 comments

Comments

@dionridley
Copy link

It appears the redirect_uri config is not being respected during authentication flow for the apple provider. I don't know if this is true of all providers as I've only tested this with the apple provider.

My application configuration is as follows.

Mix.exs

      ...
      {:phoenix, "~> 1.7.2"},
      ...
      {:pow_assent, "~> 0.4.18"},
      {:certifi, "~> 2.4"},
      {:ssl_verify_fun, "~> 1.1"}
      ...

config.exs

config :my_app, :pow_assent,
  providers: [
    ...
    apple: [
      client_id: System.get_env("APPLE_OAUTH_CLIENT_ID"),
      team_id: System.get_env("APPLE_OAUTH_TEAM_ID"),
      private_key_id: System.get_env("APPLE_OAUTH_PRIVATE_KEY_ID"),
      private_key_path: System.get_env("APPLE_OAUTH_PRIVATE_KEY_PATH"),
      redirect_uri: System.get_env("APPLE_OAUTH_REDIRECT_URI"),
      strategy: Assent.Strategy.Apple
    ]
  ]

This is an issue for me because apple does not allow you to use a http address (like localhost) for your domain or callback. I attempted to use ngrok to give me a https address for the server which works but when you get redirected it appears to be using the configured host and port from phoenix's config.exs files to tell it what the redirect_uri should be.

Even after attempting to hack my way out of it by switching those to match the server so they get passed along it still fails as my local server isn't https so it passes a http address to apple.

Am I missing something in how this should be configured or is this a bug? Also is there a way to configure this to always use the hostname the client is browsing vs. the configuration on the server? I can see scenarios where the deployment environment might want the client's url vs. the server's configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant