401 Error on Multiple Pod Saves

Hello All,

I have a data stream that ingests data then saves the new data every 10 seconds to a specific resource. This seems to work until a certain point at which all saves and gets to the resource return a 401 error until I kill the process and restart it. The server is ESS. Does anyone have an idea about this?

Thanks

401 like this would absolutely imply your session has expired, you’d have to share some code. If you’re using @inrupt/solid-client-authn-node, then periodically the session will emit an event refresh token event, and then the session needs to be updated, it’s kind of documented here: Authenticate (Node.js: Single-User App) — Inrupt JavaScript Client Libraries

But, if your script is only updating periodically, creating a session when you do the update, rather than holding the session open may be better.

1 Like

Thanks for the response.

I see what you mean - however how do I retrieve the initial refresh token in nodejs using the Inrupt libraries? I didn’t see an example for it unless I missed it.

It’s emitted by an event, it is in the docs; but it all depends on what your code looks like

I see. I believe I am using static access as there is no mention or instance of a refresh token for authorization. After some number of saves or time, my next save is met with a 401 Unauthorized error. Is there a time/push limit for static access?

Even with static client credentials, you still get a time bound access token and refresh token, and sometimes an ID token, you can see this in the code here: solid-client-authn-js/ClientCredentialsOidcHandler.ts at main · inrupt/solid-client-authn-js · GitHub

2 Likes

Am I correct that if one logs in with a provider whose access token is longer, one can can use that instead? For example, if, on my ESS pod, I give all rights to my solidcommunity.net WebID and then login at solidcommunity.net, I will have a longer timeout when visiting ESS?

[EDIT] … or would the longer timeout only apply to the user, but not to the app?

Thank you. Is there perhaps a code sample in js/ts to get the initial refresh token? I understand the onNewRefreshToken callback, but retrieving the initial refresh token was not demonstrated to my knowledge.

That’d depend on the identity provider of the authenticated user, and also on the pod storage provider, I think. But mostly the former.