Skip to content

Conversation

@dragonhunt02
Copy link

I wrote a PowAssent custom Oauth2 strategy and controller for a native desktop app, but I ran into auth errors at

"""
@spec grant_access_token(Keyword.t(), binary(), Keyword.t()) :: {:ok, map()} | {:error, term()}
def grant_access_token(config, grant_type, params) do
auth_method = Keyword.get(config, :auth_method)
token_url = Keyword.get(config, :token_url, "/oauth/token")
with {:ok, base_url} <- Assent.fetch_config(config, :base_url),
{:ok, auth_headers, auth_body} <- authentication_params(auth_method, config) do
headers = [{"content-type", "application/x-www-form-urlencoded"}] ++ auth_headers

The third-party service I use requires "X-Api-Version" header on access token requests.
I tried setting headers in strategy, but it doesn't seem to work.

I propose adding an optional config parameter to allow custom headers in Oauth2 request

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

Successfully merging this pull request may close these issues.

1 participant