I'm setting up the on-prem Habitat Depot following the instructions detailed in the repo README here: on-prem-builder. I'm getting the following error message after configuring GitHub OAuth and could use some help troubleshooting.
Authentication Failed, Unable to retrieve OAuth token
I've verified that my client id and client secret match what is in /hab/svc/builder-api/config/config.toml and that my GitHub OAuth app URLs are filled out correctly, here is a screenshot of the config (the domain names are internal-only)
There is a server piece that does authentication as well. Is there anything in the server logs (which you should be able to mine with journalctl) that looks like an error, specifically around the /authenticate endpoint?
Yeah I think this is definitely part of the problem. Somehow you have multiple supervisors trying to bind to the same port. Any time you enter a studio, it tries to start a supervisor in the background, and if there’s already one running outside the studio, that will likely cause a conflict. You can enter a studio without starting a supervisor by running env HAB_STUDIO_SUP=0 hab studio enter.
You can have both TCP and UDP listening on the same port at the same time without any problems. As far as I know, this is expected behavior from the supervisor. I don’t think that’s what’s causing your error.
I think it’s a red herring, it’s only when using the sl command from within the studio, when I ran as @raskchanky suggested the Cannot bind to port error went away, but I’m still having the OAuth issues.
When you enter a studio, you start a supervisor in the background. If you are entering a studio on the same node as the Habitat Depot is running, you’ll get a collision
Totally understood, I’m past that point and back to the original problem of OAuth and GitHub not working, curious if any other troubleshooting steps I can take.
I did a complete re-install (super easy ), and deleted/recreated the app in GitHub, got a new Client/Priv token, and still the same issue. I’m wondering if others are having this issue with on-prem Depot or not. I’ve been looking at GitHub’s OAuth documentation and the 302 redirect may be the issue here? Not sure…
This is the first issue like this that we’ve seen. We have a number of people using the on-prem depot with GitHub without issues.
It’s difficult to assist any further without more detailed information from your browser console and/or server logs. One possibility would be to right click in the network pane of the dev tools and save everything as a HAR file (not to be confused with hart file, different things) and send the HAR file to one of the Habitat core team members via Slack. That would let us see exactly what you’re seeing.
FWIW, the 302 from GitHub is correct. The way it should work is, after clicking the sign in button, you’re redirected to GitHub, which redirects back to your site with a code. The server then uses that code to authenticate your user and pull down some relevant information. The debug log that you posted from Firefox looks like that’s exactly what’s happening.