这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Aug 23, 2024. It is now read-only.

[ISSUE #297] return headers in login callback for authentication #299

Merged
merged 3 commits into from
Dec 3, 2017

Conversation

thatkookooguy
Copy link
Contributor

resolves #297

Let me know if you want me to do something similar in the web login flow

basically, changed the login function to this:

var scopes = {
  'add_scopes': ['user', 'repo', 'gist'],
  'note': 'admin script'
};

github.auth.config({
  username: 'pksunkara',
  password: 'password'
}).login(scopes, function (err, id, token, headers) {
  console.log(id, token);
});

add headers to login callback


also add headers to error


also on error


make sure headers are passed in correct param


also update the readme.md file
@@ -63,13 +63,13 @@ auth = module.exports =

request options, (err, res, body) ->
if err?
callback err
callback(err, null, null, res.headers)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when res doesn't exist or res.headers doesn't exist.

Copy link
Contributor Author

@thatkookooguy thatkookooguy Dec 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it to return an undefined if res doesn't exist.
if res exists, it's an object. So, if res.headers doesn't exist, it will just return undefined as well.

@pksunkara
Copy link
Owner

Yeah, please add it to the other flow too. Thanks.

Copy link
Contributor Author

@thatkookooguy thatkookooguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made the changes.

Please tell me if there are any more changes you want me to make.

@pksunkara pksunkara merged commit 5512b37 into pksunkara:master Dec 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

auth.config().login doesn't return headers
2 participants