oh, am I understanding correctly that you're spinning up an HTTP server to authenticate your users in a desktop app and that is the reason you want to close the server as soon as the auth completes?
If so I would say that you can use global vars in your code, but I would recommend a different way: encapsulating your app data in a single `State` or (`Game` or `AppData` or whatever you wanna call it) type. That way you can pass it around and it can contain your http server, which you can then close without worrying about global var problems. This is how I usually structure my apps and it works well.