walt-id / waltid-identity

All-in-one open-source identity and wallet toolkit.
Apache License 2.0
117 stars 43 forks source link

Error while using wallet api from Swagger UI #414

Closed eminademburan closed 3 months ago

eminademburan commented 3 months ago

I am running the wallet, issuer and verifier API as stated in this link. https://docs.oss.walt.id/wallet/api/setup/open-source.

Then, I start a credential exchange flow in the issuer API using the following endpoint:

/openid4vc/jwt/issue

Then, I am trying to use the openid credential offer link I obtained from above endpoint to these two endpoints in the wallet API.

/wallet-api/wallet/{wallet}/exchange/resolveCredentialOffer

and

/wallet-api/wallet/{wallet}/exchange/useOfferRequest. But I get the following errors in the attached file: issue.txt

I don't fully understand whether I need to use another method to use these endpoints from Swagger UI. Can you help with this?

Also, I do not get the same error when I run the identity repo with the following commands : cd docker-compose && docker-compose up

mikeplotean commented 3 months ago

yes, with docker compose the reverse proxy is done for you but when running the containers standalone, you need to know the address of the container to be able to talk with it which means the issuer-service.conf and verifier-service.conf should be updated to those specific ip addresses

it might be easier to create a network and run the containers within that network this makes it possible to reference the container by name (aka automatic service discovery)

so the setup would look smth. like this:

  1. update configs (replace baseUrl)
    • waltid-issuer-api/issuer-service.conf
      baseUrl = "http://issuer:7002"
    • waltid-verifier-api/verifier-service.conf
      baseUrl = "http://verifier:7003"
      1. create the user network
        docker network create --driver bridge waltnet
      2. run the named containers on the same network (in this case waltnet)
docker run \
    -p 7001:7001 \
    --name wallet \
    --network waltnet \
    -itv $(pwd)/waltid-wallet-api/config:/waltid-wallet-api/config \
    -itv $(pwd)/waltid-wallet-api/data:/waltid-wallet-api/data \
    -t waltid/wallet-api
docker run \
    --name issuer \
    --network waltnet \
    -p 7002:7002 \
    -itv $(pwd)/waltid-issuer-api/config:/waltid-issuer-api/config \
    -t waltid/issuer-api
docker run \
    --name verifier \
    --network waltnet \
    -p 7003:7003 \
    -itv $(pwd)/waltid-verifier-api/config:/waltid-verifier-api/config \
    -t waltid/verifier-api

Now, when generating an offer request url it would look like:

openid-credential-offer://issuer:7002/?credential_offer_uri=http%3A%2F%2Fissuer%3A7002%2Fopenid4vc%2FcredentialOffer%3Fid%3D9590e240-f2cd-4c9d-a9dd-9cd78e9dbadb

Notice localhost being replaced by the container name (in this case issuer).

More on docker networking can be found at https://docs.docker.com/network/network-tutorial-standalone.

eminademburan commented 3 months ago

Thank you for your response @mikeplotean. After doing what you said, the credential issuance worked as expected, but this time I started getting an error while trying to do verification of the verifiable credential. I am using the following endpoint from wallet API.

/wallet-api/wallet/{wallet}/exchange/usePresentationRequest

Wallet API gives an error as you can see in the attached file. I do not get the error when I run the APIs using docker compose, but I get the error when I run the containers in standalone. Can you help with that?

issue 2.txt