Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

Token Auth Issues #95

Open
ShoGinn opened this issue Feb 29, 2020 · 8 comments
Open

Token Auth Issues #95

ShoGinn opened this issue Feb 29, 2020 · 8 comments
Labels

Comments

@ShoGinn
Copy link

ShoGinn commented Feb 29, 2020

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.
@SISheogorath
Copy link
Owner

Do you have 2FA enabled? This might be the cause as iirc the node module that is used here, doesn't support it.

@ShoGinn
Copy link
Author

ShoGinn commented Mar 1, 2020

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

@SISheogorath
Copy link
Owner

SISheogorath commented Mar 1, 2020 via email

@ShoGinn
Copy link
Author

ShoGinn commented Mar 1, 2020

Yeah it’s not 2FA just personal token. Just didn’t know if there was a different api call.

Sent with GitHawk

@jeff-cook
Copy link

It looks like the docker-hub-api module does support a token auth instead of password.

https://github.com/RyanTheAllmighty/Docker-Hub-API#setlogintokentoken

@ShoGinn
Copy link
Author

ShoGinn commented Apr 6, 2020

It looks like the docker-hub-api module 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

@jeff-cook
Copy link

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.

@jeff-cook
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants