interledger / interledger-rs

An easy-to-use, high-performance Interledger implementation written in Rust
http://interledger.rs
Other
201 stars 70 forks source link

Authorization error when sending payment #653

Closed georgeroman closed 4 years ago

georgeroman commented 4 years ago

I have the following script for setting up accounts between two parties:

#!/bin/bash

printf "Adding Alice's account...\n"
ilp-cli accounts create alice \
    --auth alice_auth_token \
    --ilp-address example.alice \
    --asset-code "coin#test" \
    --asset-scale 2 \
    --max-packet-amount 100 \
    --ilp-over-http-incoming-token in_alice \
    --settle-to 0 &

printf "Adding Bob's Account...\n"
ilp-cli --node http://localhost:8770 accounts create bob \
    --auth bob_auth_token \
    --ilp-address example.bob \
    --asset-code "coin#test" \
    --asset-scale 2 \
    --max-packet-amount 100 \
    --ilp-over-http-incoming-token in_bob \
    --settle-to 0 &

# This will trigger a SE setup account action on Alice's side
printf "Adding Bob's account on Alice's node...\n"
ilp-cli accounts create bob \
    --auth alice_auth_token \
    --ilp-address example.bob \
    --asset-code "coin#test" \
    --asset-scale 2 \
    --max-packet-amount 100 \
    --settlement-engine-url http://alice-settlement:3000 \
    --ilp-over-http-incoming-token bob_password \
    --ilp-over-http-outgoing-token alice_password \
    --ilp-over-http-url http://bob-node:8770/accounts/alice/ilp \
    --settle-threshold 500 \
    --min-balance -1000 \
    --settle-to 0 \
    --routing-relation Peer &

# This will trigger a SE setup account action on Bob's side
printf "Adding Alice's account on Bob's node...\n"
ilp-cli --node http://localhost:8770 accounts create alice \
    --auth bob_auth_token \
    --ilp-address example.alice \
    --asset-code "coin#test" \
    --asset-scale 2 \
    --max-packet-amount 100 \
    --settlement-engine-url http://bob-settlement:3001 \
    --ilp-over-http-incoming-token alice_password \
    --ilp-over-http-outgoing-token bob_password \
    --ilp-over-http-url http://alice-node:7770/accounts/bob/ilp \
    --settle-threshold 500 \
    --settle-to 0 \
    --routing-relation Peer &

The ILP nodes together with the settlement engines for each node are run inside a Docker network. This all works without any issues. However, making a payment from Alice to Bob (or from Bob to Alice) via ilp-cli pay alice --auth in_alice --to http://bob-node:8770/accounts/bob/spsp --amount 10 fails with the following authorization issue:

ILP CLI error: Unexpected response from server: 401 Unauthorized: {"type":"about:blank","title":"Unauthorized","status":401,"detail":"account `alice` is not authorized for this action","datetime":"2020-07-04T08:17:11.191701804+00:00"}

I've also tried with all possible values for --auth (in_alice, alice_auth_token, alice_password) but none worked.

Does anyone have any insights on what might be the issue?

georgeroman commented 4 years ago

Solved! I was running the connectors within a Docker network but was issuing the commands from the outside. Running ilp-cli within the same network fixed the issue. I think this should be documented somewhere.