# LDAP and Google auth

**URL:** <https://talk.getindico.io/t/ldap-and-google-auth/679>\
**Category:** Administrators\
**Created:** [September 26, 2018, 1:38pm UTC](https://talk.getindico.io/t/ldap-and-google-auth/679 "2018-09-26T13:38:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mvala](https://talk.getindico.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@mvala](https://talk.getindico.io/u/mvala)\
**Post date:** [September 26, 2018, 1:38pm UTC](https://talk.getindico.io/t/ldap-and-google-auth/679/1 "2018-09-26T13:38:08Z")

</div>

I would like to use own ldap auth and also give users to auth via google account. Can you give me hint how to configure it? Thank you very much

---

<div class="post-metadata">

**Author:** ![pferreir](https://talk.getindico.io/user_avatar/talk.getindico.io/pferreir/32/7_2.png) [@pferreir](https://talk.getindico.io/u/pferreir)\
**Post date:** [September 27, 2018, 10:21am UTC](https://talk.getindico.io/t/ldap-and-google-auth/679/4 "2018-09-27T10:21:25Z")

</div>

You can use the default OAuth authenticator, it should work with most providers:

[https://docs.getindico.io/en/stable/config/auth/#authentication-providers](https://docs.getindico.io/en/stable/config/auth/#authentication-providers)

It will look like something like this:

```auto
AUTH_PROVIDERS = {
    "google-oauth": {
        "type": "oauth",
        "title": "Google",
        "oauth": {
            "access_token_method": "POST",
            "authorize_url": "https://accounts.google.com/o/oauth2/auth",
            "consumer_key": "xxxxxxxx",
            "consumer_secret": "xxxxxxx",
            "request_token_url": None,
            "access_token_url": "https://accounts.google.com/o/oauth2/token",
        },
        "callback_uri": "/auth/oauth2/callback",
        "user_info_endpoint": "https://www.googleapis.com/oauth2/v2/userinfo"
    },
    "your-ldap": ...
}

```

I haven’t tested it, but it should be enough to get you started.

---

<div class="post-metadata">

**Author:** ![mvala](https://talk.getindico.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@mvala](https://talk.getindico.io/u/mvala)\
**Post date:** [September 27, 2018, 10:44am UTC](https://talk.getindico.io/t/ldap-and-google-auth/679/5 "2018-09-27T10:44:15Z")

</div>

Thank you very much. Let me test it

---

<div class="post-metadata">

**Author:** ![mvala](https://talk.getindico.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@mvala](https://talk.getindico.io/u/mvala)\
**Post date:** [September 27, 2018, 11:00am UTC](https://talk.getindico.io/t/ldap-and-google-auth/679/6 "2018-09-27T11:00:25Z")

</div>

I have added your config to mine and what do i need to put IDENTITY\_PROVIDERS and PROVIDER\_MAP

```
AUTH_PROVIDERS = {
    'ldap': {
        'type': 'ldap',
        'title': 'OBL LDAP',
        'ldap': _ldap_config,
        'default': True
    },
    "google-oauth": {
        "type": "oauth",
        "title": "Google",
        "oauth": {
...
    }
}

IDENTITY_PROVIDERS = {
    'ldap': {
        'type': 'ldap',
        'title': 'LDAP',
        'ldap': _ldap_config,
        'mapping': {
            'first_name': 'givenName',
            'last_name': 'sn',
            'email': 'mail',
            'affiliation': 'company',
            'phone': 'telephoneNumber',
        },
        'trusted_email': True,
        'default_group_provider': True,
        'synced_fields': {'first_name', 'last_name', 'affiliation', 'phone', 'address'}
    }
}

PROVIDER_MAP = {
    'ldap': 'ldap'
}
```

---

<div class="post-metadata">

**Author:** ![pferreir](https://talk.getindico.io/user_avatar/talk.getindico.io/pferreir/32/7_2.png) [@pferreir](https://talk.getindico.io/u/pferreir)\
**Post date:** [September 27, 2018, 11:45am UTC](https://talk.getindico.io/t/ldap-and-google-auth/679/7 "2018-09-27T11:45:02Z")

</div>

I believe this example GitHub config may help:

[https://flask-multipass.readthedocs.io/en/latest/quickstart/#id3](https://flask-multipass.readthedocs.io/en/latest/quickstart/#id3)
