ory / ory/sdk

Ory Hydra Client for Elixir has a typo which breaks the client

Open
#285 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
178
Forks
96
Avg merge
6d 23h
Merged PRs (30d)
3

Description

Preflight checklist
Describe the bug
 def authorization(token, _scopes) when is_binary(token) do
   {Tesla.Middleware.Headers, ["authorization", token]}
 end

should be

def authorization(token, _scopes) when is_binary(token) do
   {Tesla.Middleware.Headers, [{"authorization", token}]}
end
Reproducing the bug

Try running any requests

Relevant log output
** (FunctionClauseError) no function clause matching in anonymous fn/1 in Tesla.Adapter.Httpc.request/2    
    
    The following arguments were given to anonymous fn/1 in Tesla.Adapter.Httpc.request/2:
    
        # 1
        "authorization"
    
    (tesla 1.7.0) lib/tesla/adapter/httpc.ex:55: anonymous fn/1 in Tesla.Adapter.Httpc.request/2
    (elixir 1.14.4) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.14.4) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (tesla 1.7.0) lib/tesla/adapter/httpc.ex:55: Tesla.Adapter.Httpc.request/2
    (tesla 1.7.0) lib/tesla/adapter/httpc.ex:22: Tesla.Adapter.Httpc.call/2
    (ory_hydra 2.2.0-pre.0) lib/ory/api/o_auth2.ex:644: Ory.Api.OAuth2.o_auth2_authorize/2
    iex:5: (file)


### Relevant configuration

_No response_

### Version

e471477af9c733ee7b84a6c869a35d4a5f17b67e

### On which operating system are you observing this issue?

macOS

### In which environment are you deploying?

Ory Network

### Additional Context

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the OAuth2 authorization implementation in lib/ory/api/o_auth2.ex, using the Tesla.Adapter.Httpc stack trace to locate how the authorization header is assembled. Reproduce the failure with an authorization request and verify that the corrected header structure allows the request to complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
api
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.