linchus / omniauth-gitlab Goto Github PK
View Code? Open in Web Editor NEWStrategy for authenticating to your GitLab service
License: MIT License
Strategy for authenticating to your GitLab service
License: MIT License
I want to omniauth-gitlab with Gitlab CE 10.1. Authentication seems to be successful, but request.env['omniauth.auth'] is nil.
config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :gitlab, "xxxxx", "xxxx",
client_options: {
site: "https://gitlab.example.com/api/v4",
},
redirect_url: "http://local.example.com:3000/auth/callback",
scope: 'read_user'
end
is it a problem in my configuration?
One of the breaking changes in OmniAuth 2.0+ relates to how relative
URL installations are handled. See:
As a result, when omniauth-gitlab is used with OmniAuth 2.0+ for an app that lives at a relative URl, the #callback_url is incorrect (the relative URL is included twice).
This is because OmniAuth is now prefixing the default Strategy#request_path and Strategy#callback_path with SCRIPT_NAME, but omniaiuth-gitlab is also adding script_name to callback_url.
omniauth/omniauth-oauth2#152 (comment)
Fixed our vendored version here: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/98120
Hello, maintainer of OmniAuth here.
I just wanted to make the maintainers of this gem aware of the discussion that I have opened regarding v2.0.0 of OmniAuth. I invite you to join in and voice any concerns you may have here: omniauth/omniauth#1017
While using the OA_GL gem, I was receiving errors when trying to authenticate to my GL server. The error I received was for line 57 of gitlab.rb in strategies.
It references MultiJson, but you do not have a require 'multi_json' at the top of this rb file.
Once I added the require line, it works like a charm.
Under version 1.0.2 configuring omniauth with your Gitlab instance domain name was sufficient:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :gitlab, ENV['GITLAB_APPLICATION_ID'], ENV['GITLAB_SECRET'],
client_options: { site: 'https://example.com' }
end
Under version 1.0.3 it requires the api path to be specified.
Rails.application.config.middleware.use OmniAuth::Builder do
provider :gitlab, ENV['GITLAB_APPLICATION_ID'], ENV['GITLAB_SECRET'],
client_options: { site: 'https://example.com/api/v4' }
end
Otherwise, trying to log in through Gitlab will fail with an invalid_credentials error from Gitlab.
This change was unexpected for a tiny version bump.
Is it possible to use other GitLab's scopes with this gem? At the moment it seems to work only when using the api
scope. If read_user
and openid
are chosen on GitLab end it doesn't work. They return the following message: The requested scope is invalid, unknown, or malformed.
.
see https://gitlab.com/gitlab-com/support-forum/issues/1270 for background discussion
Here's the full error. I've been able to configure GitHub and Google devise/omniauth with problems.
E, [2016-02-12T10:54:55.373224 #15141] ERROR -- omniauth: (gitlab) Authentication failure! invalid_credentials: OAuth2::Error, invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
Any ideas?
please help,
i tried setup gollum with omniauth-gitlab, but i got redirect uri included is not valid message on page
thanks
Would it be possible to get a few usage examples in the readme?
I want to make a form in my site that lets a user enter their own GitLab instance URL, and then log in with that. How can I do that with this strategy?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.