Ldap authentication not working on ubuntu 16.04

Hello all,

Please can some one help me troubleshooting my LDAP config ? I have dug and try many ideas from the net. No success.
This is my gitlab.rb content :

gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-EOS # remember to close this block with 'EOS' below
main: # 'main' is the GitLab 'provider ID' of this LDAP server
  label: 'LDAP'
  host: 'vpsXXXXXX.ovh.net'
  port: 389
  uid: 'sAMAccountName'
  method: 'plain' # "tls" or "ssl" or "plain"
  bind_dn: 'cn=admin,dc=vpsXXXXXX,dc=ovh,dc=net'
  password: '****************'
  timeout: 10
  active_directory: false
  allow_username_or_email_login: false
  block_auto_created_users: true
  base: 'dc=vpsXXXXXX,dc=ovh,dc=net'
  user_filter: ''
  attributes:
    username: ['uid', 'userid', 'sAMAccountName']
    email: ['mail', 'email', 'userPrincipalName']
    name: 'cn'
    first_name: 'givenName'
    last_name: 'sn'
EOS

Using ldapsearch with the same parameters yield the list of all my ldap users:

ldapsearch -H ldap://vpsXXXXXX.ovh.net:389 -D 'cn=admin,dc=vpsXXXXXX,dc=ovh,dc=net' -w ************** -b "DC=vpsXXXXXX,DC=ovh,DC=net" "" sAMAccountName

But when I run the gitlab check task I get no user :

dorice@vpsXXXXXX:~$ sudo gitlab-rake gitlab:ldap:check RAILS_ENV=production
Checking LDAP ...

LDAP users with access to your GitLab server (only showing the first 100 results)
Server: ldapmain

Checking LDAP ... Finished

My /var/log/gitlab/unicorn/unicorn_stdout.log has the following lines :
I, [2017-03-23T16:30:50.221781 #22735] INFO – omniauth: (ldapmain) Callback phase initiated.
E, [2017-03-23T16:30:50.228906 #22735] ERROR – omniauth: (ldapmain) Authentication failure! invalid_credentials encountered.

Finally, this is my gitlab info :
dorice@vpsXXXXXX:~$ sudo gitlab-rake gitlab:env:info

System information
System:         Ubuntu 16.04
Current User:   git
Using RVM:      no
Ruby Version:   2.3.1p112
Gem Version:    2.6.6
Bundler Version:1.13.3
Rake Version:   10.5.0
Sidekiq Version:4.1.4

GitLab information
Version:        8.12.7
Revision:       7429b21
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://gitlab.dddddddddd.net
HTTP Clone URL: http://gitlab.ddddddddd.net/some-group/some-project.git
SSH Clone URL:  git@gitlab.dddddddddd.net:some-group/some-project.git
Using LDAP:     yes
Using Omniauth: no

GitLab Shell
Version:        3.6.1
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:            /opt/gitlab/embedded/bin/git

Please thanks for your help

Replying to my post,
I finally got it working.
I used tcpdump to capture what was indeed being sent by ldapsearch and gitlab to the ldap server.
I simple comparison led me to set
uid: ‘uid’
rather than
uid: ‘sAMAccountName’
as was previously the case.
Thanks