How to create resource (PUT)

I’m currently trying to access resources in a SOLID pod for CRUD operations.
I’m basing myself on Otto-AA/solid-oidc-py: A solid-OIDC client in python (github.com), which does not have support for write operations.

I figured I could just use a PUT request (at least that is how Penny seems to do it, I can’t find proper documentation). However, I invariably get {“name”:“UnauthorizedHttpError”,“message”:“”,“statusCode”:401,“errorCode”:“H401”} as a response.

I’m using a PUT request with an empty body and following headers:
Authorization: DPoP <access_token>
DPoP: <key jwt encoded cf. solid_oidc_client/dpop_utils.py)>
Content-Type: text/turtle
Link: The W3C Linked Data Platform (LDP) Vocabulary; rel=“type”

I’m not familiar with the library but some general things to look for:

  1. Make sure your DPoP header has correctly encoded the request. It needs htm, htu, iat, and jti fields in the body.
  2. Make sure the keypair your DPoP header is using is the same keypair that was used to request the access token.
  3. Make sure the resource URI is correct, and that you do have access to write resources at that location.
  4. Make sure the access token is not expired.
  5. Make sure the access token you received is in fact a DPoP bound token. Solid-OIDC providers can also issue bearer tokens instead of DPoP ones.

Thanks for the pointers. In the end it turned out to be an issue with keypair consistency

1 Like