File: oauth2_server.py

package info (click to toggle)
python-authlib 1.6.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,024 kB
  • sloc: python: 27,412; makefile: 53; sh: 14
file content (10 lines) | stat: -rw-r--r-- 271 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
import base64

from authlib.common.encoding import to_bytes
from authlib.common.encoding import to_unicode


def create_basic_auth(username, password):
    text = f"{username}:{password}"
    auth = to_unicode(base64.b64encode(to_bytes(text)))
    return "Basic " + auth