Hi, I’m working on a lightweight browser http client that supports oauth2 and openid-connect using a middleware approach. Recently I got it far enough to authenticate/authorize me to fetch a resource from the solidcommunity.net storage server.
Hey, it’s great to see people working on new Auth libraries :D. However, I’m not sure I can try yours because it seems to be coupled to MetroJS. How hard do you think it would be to make this available for any JS application?
In any case, just looking at the example in the README, I can already spot some improvements. It seems like once you’re authenticated, you have to call client.get to make a request. But most high-level libraries that work with RDF and Solid usually expect a fetch callback (see examples in rdfjs.dev). I wonder if you could expose a function that takes the same arguments as fetch, and adds all the authentication headers on the request, etc.
@muze-nl/metro is the http client, @muze-nl/metro-oidc is a middleware plugin for that client. I may reconsider the name ‘metro’ if it isn’t clear enough
there is a metro.client().fetch() function that is 100% compatible with fetch(). Its a recent addition, so I haven’t added it to the documentation yet.