Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[task]: npm whoami #3

Closed
jkuri opened this issue May 3, 2017 · 0 comments
Closed

[task]: npm whoami #3

jkuri opened this issue May 3, 2017 · 0 comments
Assignees

Comments

@jkuri
Copy link
Contributor

jkuri commented May 3, 2017

  • url /-/whoami
  • method GET

get JSON request example:

{ 
   auth: { 
     scope: '//registry.npmjs.org/',
     token: 'dc5b1058-aa9e-4953-8193-4558f83f4c3d',
     password: undefined,
     username: undefined,
     email: undefined,
     auth: undefined,
     alwaysAuth: false 
  },
  method: 'GET',
  authed: false 
}

example JSON response:

{ username: 'jkuri' } // if logged in

if you are not logged in npm itself throws an error:

npm ERR! code ENEEDAUTH
npm ERR! need auth this command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`

...so no request is performed.

  • example log output:
npm verb request uri https://registry.npmjs.org/-/whoami
npm verb request no auth needed
npm info attempt registry request try #1 at 12:54:21 PM
npm verb request using bearer token for auth
npm verb request id 2dc475123102381
npm http request GET https://registry.npmjs.org/-/whoami
npm http 200 https://registry.npmjs.org/-/whoami
{ username: 'jkuri' }
npm verb headers { 'content-type': 'application/json',
npm verb headers   'content-encoding': 'gzip',
npm verb headers   'cache-control': 'max-age=300',
npm verb headers   'transfer-encoding': 'chunked',
npm verb headers   'accept-ranges': 'bytes',
npm verb headers   date: 'Wed, 03 May 2017 10:54:22 GMT',
npm verb headers   via: '1.1 varnish',
npm verb headers   connection: 'keep-alive',
npm verb headers   'x-served-by': 'cache-fra1234-FRA',
npm verb headers   'x-cache': 'MISS',
npm verb headers   'x-cache-hits': '0',
npm verb headers   'x-timer': 'S1493808862.011301,VS0,VE6',
npm verb headers   vary: 'Accept-Encoding' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants