Hello,
I use GitLab CE. I want my users to authenticate to my WordPress website using OAuth. I use the WP Oauth Server for WordPress. The OAuth endpoints are documented here.
My Gitalb configuration looks like so:
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['oauth2_generic']
#gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'Website'
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_external_providers'] = ['Website', 'oauth2_generic']
gitlab_rails['omniauth_providers'] = [{
"name" => "oauth2_generic",
"label" => "Website Connect",
"app_id" => "[redacted]",
"app_secret" => "[redacted]",
"args" => {
"name": "Gecka", # display name for this strategy
"strategy_class": "OmniAuth::Strategies::OAuth2Generic",
"client_options": {
"site": "https://website.com",
"authorize_url": '/oauth/authorize',
"token_url": '/oauth/token ',
"user_info_url": "/oauth/me"
},
"user_response_structure" => {
"root_path" => ["oauth"],
"attributes" => { "nickname": "user_login", "name": "display_name", "email": "user_email" }
}
}
}]
As per the documentation I created the client on the OAuth server with the redirect URI: http://[my-gitlab.host.com]/users/auth/oauth2_generic/callback
So, the OAuth login button shows up on the GitLab’s sign in page, when I click it, it sends me to my website for authorization. But then the OAuth server complains about bad redirect URI:
{"error":"redirect_uri_mismatch","error_description":"The redirect URI provided is missing or does not match","error_uri":"http:\/\/tools.ietf.org\/html\/rfc6749#section-3.1.2"}
I tried accessing the redirect uri manually, I get the GitLab’s sign in page with that error:
What am I doing wrong ?