metabasepy
metabasepy copied to clipboard
Google Sign-On / LDAP Authentication Support
Just wonder if there is any roadmap to support Google Sign-On / LDAP, or is there an alternative way to achieve that? Thanks.
Hi, Yes, may be we can implement sign-in / authenticate feature. There is some information about it (https://github.com/metabase/metabase/blob/master/docs/api-documentation.md#post-apisessiongoogle_auth) but i have to test / reverse-check this endpoint for reasonable client implementation. Metabase's api doc is very superficial...
import requests
cookies = {
}
headers = { 'Connection': 'keep-alive', 'Accept': 'application/json', 'Sec-Fetch-Dest': 'empty', 'Content-Type': 'application/json', 'Accept-Language': 'en-US,en;q=0.9', }
data = '{"token":"YOU GOOGLE ID TOKEN HERE"}'
response = requests.post('https://YOUR BASE URL HERE/api/session/google_auth', headers=headers, cookies=cookies, data=data) from metabasepy import Client
cli = Client(username="fake", password="not_using", base_url="https://YOUR BASE URL HERE")
cli.token = response.json()['id']
gotya: https://github.com/metabase/metabase/issues/6594
helpful: https://github.com/googleapis/google-auth-library-python/blob/master/google/oauth2/id_token.py