def METHOD_NAME(*args, **kwargs):
	try:
		r = frappe.request
		headers, body, status = get_oauth_server().create_token_response(
			r.url, r.method, r.form, r.headers, frappe.flags.oauth_credentials
		)
		body = frappe._dict(json.loads(body))
		if body.error:
			frappe.local.response = body
			frappe.local.response["http_status_code"] = 400
			return
		frappe.local.response = body
		return
	except (FatalClientError, OAuth2Error) as e:
		return generate_json_error_response(e)