# Preview Deploy Authentication

**URL:** <https://answers.netlify.com/t/preview-deploy-authentication/22744>\
**Category:** Support\
**Tags:** branch-deploys, authentication\
**Created:** [September 16, 2020, 11:52pm UTC](https://answers.netlify.com/t/preview-deploy-authentication/22744 "2020-09-16T23:52:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![knoxjeffrey](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/knoxjeffrey/32/17601_2.png) [@knoxjeffrey](https://answers.netlify.com/u/knoxjeffrey)\
**Post date:** [September 16, 2020, 11:52pm UTC](https://answers.netlify.com/t/preview-deploy-authentication/22744/1 "2020-09-16T23:52:01Z")

</div>

Hello,

I can see from the documentation that it is possible to enable Basic Auth for preview deploys in order to restrict access. Is it possible to enable other authentication for preview deploys like Netlify Identity or use a third party like GitHub?

Many thanks,  
Jeff

---

<div class="post-metadata">

**Author:** ![Dennis](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dennis/32/34_2.png) [@Dennis](https://answers.netlify.com/u/Dennis)\
**Post date:** [September 21, 2020, 3:51pm UTC](https://answers.netlify.com/t/preview-deploy-authentication/22744/2 "2020-09-21T15:51:19Z")

</div>

Hi @knoxjeffrey, the basic-auth access control is done via a custom header so it’s pretty straightforward to implement. However, with Netlify Identity, you would likely need to implement a lot of that code in your site directly. So, while it is likely possible, a lot of the work will fall to you.

Let me know if you have any other questions.

---

<div class="post-metadata">

**Author:** ![bmansheim](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/bmansheim/32/30153_2.png) [@bmansheim](https://answers.netlify.com/u/bmansheim)\
**Post date:** [October 7, 2021, 9:44am UTC](https://answers.netlify.com/t/preview-deploy-authentication/22744/3 "2021-10-07T09:44:03Z")

</div>

Do you mean that authentication for previews needs to be custom implemented and is not an option in the site settings?  
Either way, please point to any further information that can help me restrict access to previews.

---

<div class="post-metadata">

**Author:** ![luke](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/luke/32/39_2.png) [@luke](https://answers.netlify.com/u/luke)\
**Post date:** [October 8, 2021, 4:28am UTC](https://answers.netlify.com/t/preview-deploy-authentication/22744/4 "2021-10-08T04:28:30Z")

</div>

Hi, @bmansheim. The headers in the `netlify.toml` format might look like this:

```nohighlight
[[headers]]
  for = "/*"
  [headers.values]
    Basic-Auth = "someuser:somepassword anotheruser:anotherpassword"

```

Would you please try that and let us know if there are other questions (or if it doesn’t work for you)?

---

<div class="post-metadata">

**Author:** ![bmansheim](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/bmansheim/32/30153_2.png) [@bmansheim](https://answers.netlify.com/u/bmansheim)\
**Post date:** [October 10, 2021, 8:37am UTC](https://answers.netlify.com/t/preview-deploy-authentication/22744/5 "2021-10-10T08:37:37Z")

</div>

Ah. So I would have to change the netlify.toml file in the branch and then remove that change before the merge to the public site so that the authentication wouldn’t get applied to the public site. I think I got it. Thanks.
