# Auth0 Security

## 🔐 What is Auth0 security ?

Using the [Auth0](https://www.auth0.com) security item you can integrate your surveys using your existing auth0 infrastructure to authenticate users before taking the survey.&#x20;

Using Auth0 you can restrict access and ask login credential using any of the activated user provider of your auth0 account like Active Directory, LinkedIn, Google, FaceBook accounts.

{% hint style="info" %}
You may use [data attributes](/form-management/security/data-attributes.md) to pipe or use your auth0 logged in user attributes in your survey texts or [survey logic](/form-management/form-designer/condition-rules.md).&#x20;
{% endhint %}

## 🚀 Setup Auth0

To configure the Auth0 security you need to create in your [Auth0 account](https://manage.auth0.com/) an Application and a back end API.

To create the application go to the Auth0 administration section and **create the application.**

![](/files/-MDE0huWvStKQLVBBa-m)

Select the **Single Page Web Applications** as your application type

![](/files/-MD3_ccKyLznkbcGw-Xq)

In your application settings set the Allow **Callback URLs** to `https://www.ngsurvey.com/s/auth0redirect`&#x20;

![](/files/-MD3sHHW8U0mj42yZhSk)

{% hint style="warning" %}
If you're using a self-hosted on-premise version make sure to replace the [www.ngsurvey.com](http://www.ngsurvey.com) domain by the domain used that runs your own ngSurvey instance.  &#x20;
{% endhint %}

Once you have your application is setup copy from its Settings tab the **Domain** and **Client ID** and paste the values in your ngSurvey security item settings.

![](/files/-MD3aOIBFTHGHWQTLc64)

Go back to your [Auth0 administration section](https://manage.auth0.com/) and in the API section **create a new API.**

![](/files/-MD3bJejQlK3itgMeoWu)

Create the new API using a unique identifier.

![](/files/-MD3bpQvcH2wliwtB1Ua)

Copy the **Identifier** and paste it in your ngSurvey Auth0 security item settings.

![](/files/-MD3cNRn4ilKb1iVYHiq)

Thats it! Your survey is now only available to users that have been authenticated using your Auth0 server settings.

## 🔅 Auth0 security properties

* **`Domain`** is your auth0 domain.&#x20;
* **`Client Id`** client id of your auth0 single page application.
* **`Identifier / Audience`** audience identifier of your auth0 web api.
* **`Allow multiple submissions`** can a respondent take part multiple time to the same survey.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ngsurvey.com/form-management/security/security-items/auth0-security.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
