MCPcopy Create free account
hub / github.com/cloudflare/cloudflared / get_tail_token

Method get_tail_token

component-tests/cli.py:45–60  ·  view source on GitHub ↗

Get management token using the 'tail token' command. Returns a token scoped for 'logs' resource.

(self, config, config_path)

Source from the content-addressed store, hash-verified

43 return json.loads(result.stdout.decode("utf-8").strip())["token"]
44
45 def get_tail_token(self, config, config_path):
46 """
47 Get management token using the 'tail token' command.
48 Returns a token scoped for 'logs' resource.
49 """
50 basecmd = [config.cloudflared_binary]
51 if config_path is not None:
52 basecmd += ["--config", str(config_path)]
53 origincert = get_config_from_file()["origincert"]
54 if origincert:
55 basecmd += ["--origincert", origincert]
56
57 cmd_args = ["tail", "token", config.get_tunnel_id()]
58 cmd = basecmd + cmd_args
59 result = run_subprocess(cmd, "tail-token", self.logger, check=True, capture_output=True, timeout=15)
60 return json.loads(result.stdout.decode("utf-8").strip())["token"]
61
62 def get_management_url(self, path, config, config_path, resource):
63 access_jwt = self.get_management_token(config, config_path, resource)

Callers 1

Calls 3

get_config_from_fileFunction · 0.90
run_subprocessFunction · 0.85
get_tunnel_idMethod · 0.80

Tested by 1