We built dcos 1.7 cluster in aws using cloud formation template by following "launch dc/os" instructions here https://dcos.io/docs/1.7/administration/installing/cloud/aws/
I tried to run the following query using curl
curl --header " Authorization: token=xxxxx" https://{dcos-elb}/service/chronos/scheduler/jobs
but got
<html>
<head>
<title>Unauthorized</title>
<noscript><meta http-equiv="refresh" content="5; url=/#/login"></noscript>
<script>
(function () {
var location = window.location;
location.href = "/#/login?redirect=" + encodeURIComponent(location.href);
}())
</script>
</head>
<body>
<h1>Unauthorized</h1>
</body>
</html>
I obtained the token by following these instructions https://dcos.io/docs/1.7/administration/security/managing-authentication/#log-in-cli
i.e. in browser paste this url: https:///login?redirect_uri=urn:ietf:wg:oauth:2.0:oob, login with google creds and then copy the token
adminrouter logs in master node has following lines
[notice] 31915#0: *8026 [lua] auth.lua:119: validate_jwt_or_exit(): Invalid token. Reason: not enough data, client: xx.xx.xx.xx, server: dcos.*, request: "GET /service/chronos/scheduler/jobs HTTP/1.1", host: "xxxxx"
How can I resolve this issue ?. Do I have to include any extra payload with curl query ?
Any suggestions would be much appreciated. Thanks
First do, dcos config show
and check the variable value for core.dcos_url
, make sure you are hitting "HTTP" and NOT "HTTPS".
To make the change, follow the below procedure,
1:) dcos config unset core.dcos_url
2:) dcos config set core.dcos_url <CLuster_URL_Only_HTTP>
3:) Finally you can do , dcos auth login
4:) Step (3) will return URL, which you have to paste in Browser and get the Token and paste it on the Cli, where it's waiting for Token.