hoophq / sequence

Immutable, scalable, and easy to use ledger service.
Apache License 2.0
493 stars 31 forks source link

Invalid credentials #25

Open vmendivil opened 3 years ago

vmendivil commented 3 years ago

Hi,

I cloned the repo and it's running on Docker. I'm trying to run the postman collection but so far I'm getting 403 "Invalid credentials." error message.

I'm following instructions from the GitHub repo and your documentation.

https://docs.decimals.app/docs/sequence/ZG9jOjEyOTQ0MDY-getting-started#try-out-the-api-collections

This is my docker compose:

"secret-key-hash": "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"}]' # -> 123

dockercompose

I doubled check the secret-key-hash using https://emn178.github.io/online-tools/sha256.html and it gives the same value for 123

I'm trying to hit the following endpoint: http://localhost:8910/v1/transactions?account=Alice

In postman, as far as I understand, public_key is not really that important? I see some requests only use it on the body to seed initial values, so its value shouldn't matter that much, does it? In case it does in the postman variables I'm using "public_key = abc"

About the secret_key variable in postman, I've tried the below values in the "current value" column of the environmental variables, I cleared "initial value" column just to be safe.

I'm encoding using: https://www.utilities-online.info/base64

Basic 123 Basic 123: Basic MTIz Basic MTIzOg== Basic a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3

Variables

Authorization

Request

None of those secret_key values have worked so far, I always get the same error message: "Invalid credentials." with a 401 Unauthorized code. I even tried the solution out-of-the-box and with the secrets and all that as configured in the repo and still facing the same issue.

I'm not sure what I'm doing wrong or what values I'm incorrectly setting up.

P.D. This is a fantastic work based on what I've read in the documentation and is exactly what I'm looking for, hope you can help me with this authorization issue I'm having. Thank you!!!

bigfatpaulyj commented 2 years ago

I was able to get this working with the docker-compose config supplied in the repo by using :

curl -v http://localhost:8910/v1/transactions \
  -H 'Origin: https://decimals.stoplight.io' \
  -u '123' \
  -d '{
  "from": "pk_test_decimals_docs",
  "to": "Alice",
  "amount": 1000,
  "currency": "usd"
}'

It will then ask for a password, hit 'enter' to leave it blank. The request then goes through ok.

andriosrobert commented 1 year ago

@vmendivil replying here in case someone else faces this problem; sorry I wasn't able to reply on time:

Postman is likely not adding the : after the username when the password is empty or doing something different.

Try adding the header directly instead of using http basic auth function:

Header key: Authorization Header value: Basic Basic MTIzOg==