So, GitLab 7.7 which is due to be released on 22nd January, will support OmniAuth using the doorkeeper gem. I have been fiddling with an OmniAuth strategy for GitLab and here’s what I have come up with so far:
I tested this on an app using OAuth, the authentication was successful and I signed in the test app using my GitLab credentials
But there is a caveat. In the omniauth-gitlab
gem the site url of which the authentication is made against, is hardcoded. For my testing purposes, I set up a testing branch with the site url pointing to localhost:3000
.
What is the best approach to address this issue? Could this be resolved by setting env variables? Something like:
site: ENV['OMNIAUTH_GITLAB_URL'] || 'https://gitlab.com'