readme-to-dockerhub
readme-to-dockerhub copied to clipboard
Token Auth Issues
So I tried to google-fu this...
but when using the new docker hub token authentication the API doesn't login.
Here is the error when you use an auth token:
(node:1) UnhandledPromiseRejectionWarning: Error: {"detail":"access to the resource is forbidden with personal access token"}
at Object.<anonymous> (/app/node_modules/docker-hub-api/src/api.js:1428:47)
at Request.self.callback (/app/node_modules/request/request.js:185:22)
at Request.emit (events.js:321:20)
at Request.<anonymous> (/app/node_modules/request/request.js:1161:10)
at Request.emit (events.js:321:20)
at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:427:28)
at IncomingMessage.emit (events.js:333:22)
at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Do you have 2FA enabled? This might be the cause as iirc the node module that is used here, doesn't support it.
Do you have 2FA enabled? This might be the cause as iirc the node module that is used here, doesn't support it.
@SISheogorath nope. I had enabled the personal token on one of my repos. I was using a bash script and it errored out. Found your solution and it gave me the verbose answer :). So I’m pretty sure it’s an api issue.
Sent with GitHawk
I don't think those tokens can be user for the API. I would recommend to use a bot account without 2FA instead.
Yeah it’s not 2FA just personal token. Just didn’t know if there was a different api call.
Sent with GitHawk
It looks like the docker-hub-api module does support a token auth instead of password.
https://github.com/RyanTheAllmighty/Docker-Hub-API#setlogintokentoken
It looks like the
docker-hub-apimodule does support a token auth instead of password.https://github.com/RyanTheAllmighty/Docker-Hub-API#setlogintokentoken
I think that might be the token thats in the .git file but correct me if im wrong
From the looks of it you use an env var with a token, so it seems like a replacement for the username and password. I think the login function returns a token and the setLoginToken uses a token. The token could be from the login or from the API token.
However, I have not seen a working example of it yet.
I don't know node yet, but looks like I'm going to learn.
Ok looks like maybe that is just a JWT that you can get from login or from using a browser and F12.
It looks like Docker hub just does not support access token for the admin functions, only user/password. So there is no way to automate and use 2FA.