Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Re-implement "auth" module to be instantiable #196

Open
jugglinmike opened this issue Aug 24, 2015 · 0 comments
Open

Re-implement "auth" module to be instantiable #196

jugglinmike opened this issue Aug 24, 2015 · 0 comments

Comments

@jugglinmike
Copy link

Currently, the "auth" module is implemented as a singleton. This makes it difficult to use in contexts where the same process exposes multiple OAuth endpoints. My use case is a versioned API that defines dedicated authentication routes for each version.

In the short-term, I am re-installing this module in each of my project's API-version-specific directories. Another approach (for anyone else running up against this issue) would be to remove this project's files from require.cache in each place it is used.

Ideally, I would like to be able to use the auth object in the same way as the client object. To demonstrate, here's how that would look for an example from the project's readme file:

- github.auth.config({
+ var auth = github.auth({
    username: 'pksunkara',
   password: 'password'
+ });
- }).login(['user', 'repo', 'gist'], function (err, id, token) {
+ auth.login(['user', 'repo', 'gist'], function (err, id, token) {
   console.log(id, token);
  });
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant