def login(email, password, device_id, domain='com'):
    body = {'auth_data': {'use_global_authentication': 'true', 'user_id_password': {'password': password, 'user_id': email}}, 'registration_data': {'domain': 'DeviceLegacy', 'device_type': 'A43PXU4ZN2AL1', 'device_serial': device_id, 'app_name': APP_NAME, 'app_version': APP_VERSION, 'device_model': DEVICE_NAME, 'os_version': OS_VERSION, 'software_version': '130050002'}, 'requested_token_type': ['bearer', 'mac_dms', 'store_authentication_cookie', 'website_cookies'], 'cookies': {'domain': f'amazon.{domain}', 'website_cookies': []}, 'user_context_map': {'frc': generate_frc(device_id)}, 'device_metadata': {'device_os_family': 'android', 'device_type': 'A43PXU4ZN2AL1', 'device_serial': device_id, 'mac_address': secrets.token_hex(64).upper(), 'manufacturer': MANUFACTURER, 'model': DEVICE_NAME, 'os_version': '30', 'android_id': 'f1c56f6030b048a7', 'product': DEVICE_NAME}, 'requested_extensions': ['device_info', 'customer_info']}
    response_json = requests.post(f'https://api.amazon.{domain}/auth/register', headers=get_headers(domain), json=body).json()
    try:
        return {'domain': domain, 'access_token': response_json['response']['success']['tokens']['bearer']['access_token'], 'refresh_token': response_json['response']['success']['tokens']['bearer']['refresh_token']}
    except:
        print(json.dumps(response_json))
        return None
def login(email, password, device_id, domain='com'):
    body = {'auth_data': {'use_global_authentication': 'true', 'user_id_password': {'password': password, 'user_id': email}}, 'registration_data': {'domain': 'DeviceLegacy', 'device_type': 'A43PXU4ZN2AL1', 'device_serial': device_id, 'app_name': APP_NAME, 'app_version': APP_VERSION, 'device_model': DEVICE_NAME, 'os_version': OS_VERSION, 'software_version': '130050002'}, 'requested_token_type': ['bearer', 'mac_dms', 'store_authentication_cookie', 'website_cookies'], 'cookies': {'domain': f'amazon.{domain}', 'website_cookies': []}, 'user_context_map': {'frc': generate_frc(device_id)}, 'device_metadata': {'device_os_family': 'android', 'device_type': 'A43PXU4ZN2AL1', 'device_serial': device_id, 'mac_address': secrets.token_hex(64).upper(), 'manufacturer': MANUFACTURER, 'model': DEVICE_NAME, 'os_version': '30', 'android_id': 'f1c56f6030b048a7', 'product': DEVICE_NAME}, 'requested_extensions': ['device_info', 'customer_info']}
    response_json = requests.post(f'https://api.amazon.{domain}/auth/register', headers=get_headers(domain), json=body).json()
    try:
        return {'domain': domain, 'access_token': response_json['response']['success']['tokens']['bearer']['access_token'], 'refresh_token': response_json['response']['success']['tokens']['bearer']['refresh_token']}
    except:
        print(json.dumps(response_json))
        return None