Skip to content

FunctionClauseError on Forcex.Client.login #40

@mimimalizam

Description

@mimimalizam

👋

For the time being, I'm not able to mitigate the following error, and I hope someone will be able to help me.

  • I added lines similar to the following to config/config.exs (replaced dummy text)
config :forcex, Forcex.Client,
  username: "user@example.com",
  password: "my_super_secret_password",
  security_token: "EMAILED_FROM_SALESFORCE",
  client_id: "CONNECTED_APP_OAUTH_CLIENT_ID",
  client_secret: "CONNECTED_APP_OAUTH_CLIENT_SECRET"
  • Calling Forcex.Client.login returns the following
10:34:42.335 [debug] conf=%{client_id: "xxxx", client_secret: "xxxx", password: "xxxx", security_token: "xxxx", username: "xxx"}
** (FunctionClauseError) no function clause matching in Forcex.Api.Http.process_response/1

    The following arguments were given to Forcex.Api.Http.process_response/1:

        # 1
        %{
          access_token: "xxxxx",
          id: "https://login.salesforce.com/id/xxxxx/xxxxxK",
          instance_url: "https://xxx.salesforce.com",
          issued_at: "1542879282532",
          signature: "xxxxxxxx",
          token_type: "Bearer"
        }

    Attempted function clauses (showing 5 out of 5):

        defp process_response(%HTTPoison.Response{body: body, headers: %{"Content-Encoding" => "gzip"} = headers} = resp)
        defp process_response(%HTTPoison.Response{body: body, headers: %{"Content-Encoding" => "deflate"} = headers} = resp)
        defp process_response(%HTTPoison.Response{body: body, headers: %{"Content-Type" => <<"application/json"::binary(), _::binary()>>} = headers} = resp)
        defp process_response(%HTTPoison.Response{body: body, status_code: 200})
        defp process_response(%HTTPoison.Response{body: body, status_code: status})

    (forcex) lib/forcex/api/http.ex:29: Forcex.Api.Http.process_response/1
    (forcex) lib/forcex/api/http.ex:18: Forcex.Api.Http.raw_request/5
    (forcex) lib/forcex/auth/oauth.ex:16: Forcex.Auth.OAuth.login/2
    (forcex) lib/forcex/client.ex:71: Forcex.Client.login/2

Alternatively, it would also help me if I could extract the access_token from above shared arguments.

Tnx!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions