# Social Authentication

Once a user is authenticated their full name and email address will be sent to Teneo along with every request.

{% hint style="info" %}
Longer term I would like to only send an auth token to Teneo and have Teneo validate that token and then retrieve the user information directly from Firebase.&#x20;
{% endhint %}

## Screenshots

{% tabs %}
{% tab title="Authenticated" %}

<div align="left"><img src="https://4062709520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La71Iy76rotlqbCOWoQ%2F-LdPWqWHzov_ZUY_CJPJ%2F-LdPZ7mdb-OGll8Fy-iP%2Fauthenticated.jpg?alt=media&#x26;token=fdf1a241-6275-46c7-b8ca-4c92d7d43be5" alt=""></div>
{% endtab %}

{% tab title="Menu Options" %}

<div align="left"><img src="https://4062709520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La71Iy76rotlqbCOWoQ%2F-LdPWqWHzov_ZUY_CJPJ%2F-LdPZCkRMyj3xCfDgEl5%2Fauth-menu.jpg?alt=media&#x26;token=67471f31-5647-4ea3-b449-206e42ac3b7a" alt=""></div>
{% endtab %}

{% tab title="Registration" %}

<div align="left"><img src="https://4062709520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La71Iy76rotlqbCOWoQ%2F-LdPWqWHzov_ZUY_CJPJ%2F-LdPZHOm8vkCWN95Sw7U%2Fauth-register.jpg?alt=media&#x26;token=ef7a53b8-80eb-46b6-8f11-913651cf836b" alt=""></div>
{% endtab %}

{% tab title="Login" %}

<div align="left"><img src="https://4062709520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La71Iy76rotlqbCOWoQ%2F-LdPWqWHzov_ZUY_CJPJ%2F-LdPZLkMgaFXI3-Icejk%2Fauth-login.jpg?alt=media&#x26;token=49ee4b08-de0b-4c41-807f-2efc44df66be" alt=""></div>
{% endtab %}
{% endtabs %}

## Firebase and Leopard Config

You will need to setup a Firebase project and enable social authentication for the following Sign-in providers:&#x20;

* Email/Password
* Google
* Facebook
* GitHub

Define your Firebase configuration in [Leopard's Build Variables](https://jolzee.gitbook.io/leopard/installation/build-variables).

{% code title="" %}

```javascript
const config = {
  ...,
  /**
   * Social Authentication is provided through https://firebase.google.com/
   * Empty values signals no authentication
   */
  socialAuthentication: {
    firebase: {
      apiKey: "",
      authDomain: "",
      databaseUrl: "", // Firebase Realtime Database
      messagingSenderId: "",
      microsoft: {
        domainHint: "", // my-domain.com
        tenant: "" // Azure AD Tenant ID
      },
      projectId: "", // firebase project id
      providers: ["microsoft", "facebook", "google", "github"], // login and register will only show buttons for these providers
      storageBucket: ""
    }
  },
  ...
};

module.exports = config;

```

{% endcode %}

## Capture Email and Name in Teneo

{% code title="Pre-processing Script in Teneo" %}

```groovy
if (engineEnvironment.getParameter("name")) { 
	Lib_sUserFirstName = engineEnvironment.getParameter("name").split()[0]
}

if (engineEnvironment.getParameter("email")) { 
	globalUserEmail = engineEnvironment.getParameter("email")
}
```

{% endcode %}
