Individual request web server in Zig

Hello all,
I’m very new to zig, and relatively new to programming in general. I need to get a oauth2 token to be used with the Spotify API. That flow requires me to receive a request, redirect the response and then receive another request.
My problem is that when i use httpz, the server runs until I shut down the program (the server).
What I would like to do is:

  • Call the oauth2 flow from my main program (the one that actually works with the Spotify API) as a function f .
  • Receive the request needed and eventually get the token.
  • Return the token as a return value of the function f.

Is all of this possible using a library already built in zig?

Thank you very very much in advance.

not sure how the http server running until you shut it down is a problem?

for oauth2
a quick search gives me

unfortunately, uses zigmod instead of the builtin package manager, and looks like there are some junk files in the repo

uses a local path for one of its dependencies, tho it looks like it’s on their github.

I would recommend using those as a reference to implement your own, or use a c library.
such as

unfortunately it isn’t packaged for the zig build system so you would have to do that work.
if you do pop it over to

for others to use