# basicAuth user and userfile

**URL:** <https://community.traefik.io/t/basicauth-user-and-userfile/4464>\
**Category:** Traefik v2\
**Tags:** middleware\
**Created:** [February 17, 2020, 2:07pm UTC](https://community.traefik.io/t/basicauth-user-and-userfile/4464 "2020-02-17T14:07:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![obeyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/obeyler/32/1558_2.png) [@obeyler](https://community.traefik.io/u/obeyler)\
**Post date:** [February 17, 2020, 2:07pm UTC](https://community.traefik.io/t/basicauth-user-and-userfile/4464/1 "2020-02-17T14:07:11Z")

</div>

is it normal that for user and userfile the kubernetes configuration are the same:  
[https://docs.traefik.io/middlewares/basicauth/#users](https://docs.traefik.io/middlewares/basicauth/#users)

[https://docs.traefik.io/middlewares/basicauth/#usersfile](https://docs.traefik.io/middlewares/basicauth/#usersfile)

```auto
# Declaring the user list
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-auth
spec:
  basicAuth:
    secret: authsecret

---
# Note: in a kubernetes secret the string (e.g. generated by htpasswd) must be base64-encoded first.
# To create an encoded user:password pair, the following command can be used:
# htpasswd -nb user password | openssl base64

apiVersion: v1
kind: Secret
metadata:
  name: authsecret
  namespace: default

data:
  users: |2
    dGVzdDokYXByMSRINnVza2trVyRJZ1hMUDZld1RyU3VCa1RycUU4d2ovCnRlc3QyOiRhcHIxJGQ5
    aHI5SEJCJDRIeHdnVWlyM0hQNEVzZ2dQL1FObzAK

```
