def determine_authtype_from_request(request, default='basic'):
    user_agent = request.META.get('HTTP_USER_AGENT')
    type_to_auth_map = {
        J2ME: DIGEST,
        ANDROID: BASIC,
    }
    user_type = guess_phone_type_from_user_agent(user_agent)
    if user_type is not None:
        return type_to_auth_map.get(user_type, default)
    else:
        return determine_authtype_from_header(request, default=default)
Guess the auth type, based on the (phone's) user agent or the
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/domain/auth.py/determine_authtype_from_request