# Path: dashboard/api/exceptions.py
# class AuthError(Exception):
#     def __init__(self, error, status_code):
#         self.error = error
#         self.status_code = status_code


import json
import logging
from functools import wraps
from flask import request
from flask import _request_ctx_stack
from six.moves.urllib.request import urlopen
from jose import jwt
from dashboard.api.exceptions import AuthError
        else:
            return "https://" + self.app.config.get(
                "SERVER_NAME", "sso.mozilla.com"
            )  # sso.mozilla.com

    # Format error response and append status code
    def get_token_auth_header(self):
        """Obtains the Access Token from the Authorization Header
        """
        auth = request.headers.get("Authorization", None)
        if not auth:
            raise AuthError(
                {
                    "code": "authorization_header_missing",
                    "description": "Authorization header is expected",
                },
                401,
            )

        parts = auth.split()

        if parts[0].lower() != "bearer":
            raise AuthError(
                {
                    "code": "invalid_header",
                    "description": "Authorization header must start with" " Bearer",
                },
                401,
            )
        elif len(parts) == 1:

# Path: dashboard/api/exceptions.py
# class AuthError(Exception):
#     def __init__(self, error, status_code):
#         self.error = error
#         self.status_code = status_code


# Path: dashboard/api/idp.py
import json
import logging
from functools import wraps
from flask import request
from flask import _request_ctx_stack
from six.moves.urllib.request import urlopen
from jose import jwt
from dashboard.api.exceptions import AuthError

        else:
            return "https://" + self.app.config.get(
                "SERVER_NAME", "sso.mozilla.com"
            )  # sso.mozilla.com

    # Format error response and append status code
    def get_token_auth_header(self):
        """Obtains the Access Token from the Authorization Header
        """
        auth = request.headers.get("Authorization", None)
        if not auth:
            raise AuthError(
                {
                    "code": "authorization_header_missing",
                    "description": "Authorization header is expected",
                },
                401,
            )

        parts = auth.split()

        if parts[0].lower() != "bearer":
            raise AuthError(
                {
                    "code": "invalid_header",
                    "description": "Authorization header must start with" " Bearer",
                },
                401,
            )
        elif len(parts) == 1:

            raise AuthError(