jaredhanson / jaredhanson/passport

Passport authorize documentation uses undefined variable in code sample

Open
#369 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
23.5k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

The authorize API call is described here: http://passportjs.org/docs/authorize

In the callback code sample a follow on middleware method is used to redirect after the updated account is saved to the database:

```
account.save(function(err) {
if (err) { return self.error(err); }
self.redirect('/');
});
```

However self is not defined. Instead the save callback should use res.redirect('/'), where res is available because it is defined in the function that encloses the save callback

Contributor guide

Open the contributing guide

Research direction

Open the authorize documentation at http://passportjs.org/docs/authorize and inspect the callback code sample. Confirm which response object is available in the enclosing function, update the save callback so it no longer references an undefined variable, and verify the sample has no remaining undefined reference.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, node.js
Domain
authentication, documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.