Drone

SOLVED - The Login Failed Bad credentials SAGA

Hi.

I’m getting login failed when using drone in AWS ECS ( using part of appleboys git repo) I followed the instructions but I have been getting this error no matter what I do and I did the homework to look at all the issues in discourse and elsewhere but I’m still stuck.

Information :
drone:latest as from August 10 2019.

Github Oauth config :

Drone ENVs :

  { "name": "DRONE_GITHUB_SERVER", "value": "${drone_github_server}" },
    { "name": "DRONE_GITHUB_CLIENT_ID", "value": "${drone_github_client_id}" },
    { "name": "DRONE_GITHUB_SECRET", "value": "${drone_github_secret}" },
    { "name": "DRONE_USER_CREATE", "value": "username:pepe-git,machine:false,admin:true" },
    { "name": "DRONE_GIT_ALWAYS_AUTH", "value": "true" },
    { "name": "DRONE_AGENTS_ENABLED", "value": "true" },
    { "name": "DRONE_RPC_SECRET", "value": "${drone_secret}" },
    { "name": "DRONE_SERVER_HOST", "value": "${drone_host}" },
    { "name": "DRONE_SERVER_PROTO", "value": "http" },
    { "name": "DRONE_TLS_AUTOCERT", "value": "false" },
    { "name": "DRONE_DATABASE_DRIVER", "value": "mysql" },
    { "name": "DRONE_DATABASE_DATASOURCE", "value": "${db_user}:${db_password}@tcp(${db_endpoint}:3306)/${db_name}?parseTime=true" },
    { "name": "DRONE_LOGS_DEBUG", "value": "true" },
    { "name": "DRONE_LOGS_PRETTY", "value": "true" }

This config has been getting bigger by adding DEBUG and other options I thought they could help like :

DRONE_GIT_ALWAYS_AUTH and DRONE_USER_CREATE

But there was no difference and I even disable the database thinking there was a problem there.

the logs from the container :

  {
    "level": "info",
    "msg": "main: internal scheduler enabled",
    "time": "2019-08-10T17:18:22Z"
    }
    {
    "build.limit": 15000,
    "expires": "0001-01-01T00:00:00Z",
    "kind": "trial",
    "level": "debug",
    "msg": "main: license loaded",
    "repo.limit": 0,
    "time": "2019-08-10T17:18:22Z",
    "user.limit": 0
    }
    {
    "admin": true,
    "level": "debug",
    "login": "pepe-git",
    "machine": false,
    "msg": "bootstrap: create account",
    "time": "2019-08-10T17:18:22Z",
    "token": ""
    }
    {
    "admin": true,
    "level": "debug",
    "login": "pepe-git",
    "machine": false,
    "msg": "bootstrap: updating account",
    "time": "2019-08-10T17:18:22Z",
    "token": ""
    }
    {
    "admin": true,
    "level": "debug",
    "login": "pepe-git",
    "machine": false,
    "msg": "bootstrap: account already up-to-date",
    "time": "2019-08-10T17:18:22Z",
    "token": ""
    }
    {
    "acme": false,
    "host": "REDACTED.us-east-1.elb.amazonaws.com",
    "level": "info",
    "msg": "starting the http server",
    "port": ":80",
    "proto": "http",
    "time": "2019-08-10T17:18:22Z",
    "url": "http://REDACTED.us-east-1.elb.amazonaws.com"
    }
    {
    "interval": "30m0s",
    "level": "info",
    "msg": "starting the cron scheduler",
    "time": "2019-08-10T17:18:22Z"
    }
    {
    "fields.time": "2019-08-10T17:19:01Z",
    "latency": 36458622,
    "level": "debug",
    "method": "GET",
    "msg": "",
    "remote": "10.104.3.138:6258",
    "request": "/",
    "request-id": "1PF6Y7nX1ywyJdGlsvDktvFTJWt",
    "time": "2019-08-10T17:19:01Z"
    }
    {
    "fields.time": "2019-08-10T17:19:27Z",
    "latency": 40978271,
    "level": "debug",
    "method": "GET",
    "msg": "",
    "remote": "10.104.3.138:6262",
    "request": "/login/error?message=Bad%20credentials",
    "request-id": "1PF6bQHZUGNBpGuaSqS8ny8uEEl",
    "time": "2019-08-10T17:19:27Z"
    }
    {
    "fields.time": "2019-08-10T17:19:27Z",
    "latency": 282902,
    "level": "debug",
    "method": "GET",
    "msg": "",
    "remote": "10.104.3.138:6262",
    "request": "/css/app.37cd1d03.css",
    "request-id": "1PF6bMIBl55zZHpyRshfEoQCbOv",
    "time": "2019-08-10T17:19:27Z"
    }
    {
    "level": "debug",
    "msg": "api: authentication required",
    "request-id": "1PF6bXItLSWGd6ypTrFvGE4S8xM",
    "time": "2019-08-10T17:19:28Z"
    }
    {
    "level": "debug",
    "msg": "api: guest access",
    "request-id": "1PF6bXItLSWGd6ypTrFvGE4S8xM",
    "time": "2019-08-10T17:19:28Z"
    }
    {
    "fields.time": "2019-08-10T17:19:28Z",
    "latency": 164689,
    "level": "debug",
    "method": "GET",
    "msg": "",
    "remote": "10.104.3.138:6262",
    "request": "/api/user",
    "request-id": "1PF6bXItLSWGd6ypTrFvGE4S8xM",
    "time": "2019-08-10T17:19:28Z"
    }
    {
    "level": "debug",
    "msg": "events: stream opened",
    "request-id": "1PF6bVF3FW5MZ8XQGqxp6l8Ld0Y",
    "time": "2019-08-10T17:19:28Z"
    }

ALB logs :

    http 2019-08-10T18:33:36.136695Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61516 10.104.101.151:80 0.001 0.047 0.000 200 200 466 1133 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/login/error?message=Bad%20credentials HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e00-76ce5530fd108e276ff17692" "-" "-" 100 2019-08-10T18:33:36.088000Z "forward" "-" "-"
http 2019-08-10T18:33:36.703130Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61516 10.104.101.151:80 0.000 0.001 0.000 200 200 361 1991 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/favicon.png HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e00-4cac8f0ee97873a41a8da857" "-" "-" 100 2019-08-10T18:33:36.702000Z "forward" "-" "-"
http 2019-08-10T18:34:10.642929Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61539 10.104.101.151:80 0.000 0.035 0.000 200 200 492 1133 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/login/error?message=Bad%20credentials HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e22-b317490f58669758c386fab6" "-" "-" 100 2019-08-10T18:34:10.607000Z "forward" "-" "-"
http 2019-08-10T18:34:11.172904Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61539 10.104.101.151:80 0.000 0.001 0.000 200 200 611 254677 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/js/chunk-vendors.f5840117.js HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e22-91de6e9565a0010959037460" "-" "-" 100 2019-08-10T18:34:10.832000Z "forward" "-" "-"
http 2019-08-10T18:34:15.906365Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61539 10.104.101.151:80 0.000 0.061 0.000 200 200 429 1133 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/ HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e27-fe2272747c1dad8db1658230" "-" "-" 100 2019-08-10T18:34:15.845000Z "forward" "-" "-"
http 2019-08-10T18:34:16.230410Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61539 10.104.101.151:80 0.000 0.001 0.000 401 401 429 333 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/api/user HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e28-a23e0688b3abc68ffe1948aa" "-" "-" 100 2019-08-10T18:34:16.229000Z "forward" "-" "-"
http 2019-08-10T18:34:16.878613Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61543 10.104.101.151:80 0.001 0.001 0.000 303 303 516 787 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/login HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e28-0cdec6e565e9f85ac7f45184" "-" "-" 100 2019-08-10T18:34:16.877000Z "forward" "-" "-"
http 2019-08-10T18:34:17.291337Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61539 10.104.101.151:80 0.000 0.001 0.000 200 200 488 294 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/api/stream HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e28-23b3fd4f56ff58a957f6deb9" "-" "-" 100 2019-08-10T18:34:16.764000Z "forward" "-" "-"
http 2019-08-10T18:33:36.603765Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61517 10.104.101.151:80 0.001 0.001 0.000 401 401 466 333 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/api/user HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e00-989eddce566126a4071fb4bb" "-" "-" 100 2019-08-10T18:33:36.602000Z "forward" "-" "-"
http 2019-08-10T18:34:10.485718Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61517 10.104.101.151:80 0.000 0.001 0.000 200 200 525 307 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/api/stream HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e01-4b323ba4801afe9bf25a99d2" "-" "-" 100 2019-08-10T18:33:37.200000Z "forward" "-" "-"
http 2019-08-10T18:34:10.829510Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61540 10.104.101.151:80 0.001 0.001 0.000 200 200 618 57958 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/css/app.37cd1d03.css HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e22-f59d5edc29195b8494809eb8" "-" "-" 100 2019-08-10T18:34:10.827000Z "forward" "-" "-"
http 2019-08-10T18:34:11.308994Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61541 10.104.101.151:80 0.000 0.001 0.000 200 200 601 160257 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/js/app.da7a5734.js HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e22-f8ade9e02af97c58e926c4ac" "-" "-" 100 2019-08-10T18:34:10.949000Z "forward" "-" "-"
http 2019-08-10T18:34:11.483490Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61541 10.104.101.151:80 0.000 0.001 0.000 401 401 492 333 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/api/user HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e23-3469a1cc1916bd1c2648d10c" "-" "-" 100 2019-08-10T18:34:11.482000Z "forward" "-" "-"
http 2019-08-10T18:34:11.585875Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61540 10.104.101.151:80 0.000 0.001 0.000 200 200 387 1991 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/favicon.png HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e23-c711366cccedea987a2a1d0c" "-" "-" 100 2019-08-10T18:34:11.584000Z "forward" "-" "-"
http 2019-08-10T18:34:15.787641Z app/staging-demo-droneio-alb/a0e058dc4b5a44fb 24.67.189.104:61541 10.104.101.151:80 0.000 0.001 0.000 200 200 525 294 "GET http://REDACTED.us-east-1.elb.amazonaws.com:80/api/stream HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0" - - arn:aws:elasticloadbalancing:us-east-1:REDACTED:targetgroup/staging-demo-droneio-alb-default/915e0384db6e4b2b "Root=1-5d4f0e24-9de343901355b850b83834d4" "-" "-" 100 2019-08-10T18:34:12.011000Z "forward" "-" "-"

If I revoke all user tokens in github and then hit droid again I see this :

github auth image

I look at the kubernetes configs to make sure I was not missing anything etc but no luck.

My agents are not working yet but my guess is that this should still work without agents ?

Any help will be greatly appreciated.

My agents are not working yet but my guess is that this should still work without agents ?

An agent cannot process workloads until you login an activate a repository, so this seems premature. Once you login and activate a repository, if agents are not processing builds, we have a detailed FAQ you can use to troubleshoot.

/login/error?message=Bad%20credentials HTTP/1.1

I see Bad credentials which indicates there is a problem with the client_id and client_secret that are configured. The only known root cause for this error is incorrect, empty or malformed client_secret.

EDIT you are using an incorrect variable to provide the github secret

-{ "name": "DRONE_GITHUB_SECRET", "value": "${drone_github_secret}" },
+{ "name": "DRONE_GITHUB_CLIENT_SECRET", "value": "${drone_github_secret}" },

1 Like

I just can’t believe this…that was the whole problem…copy and paste user error

Thanks so much for the quick response