Giter Site home page Giter Site logo

passport's People

Contributors

eduardoboucas avatar jimlambie avatar josephdenne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

passport's Issues

Token response format

The API returns tokens in the following format. Can the passport response be the same?

{
  "accessToken": "243606ed-e43f-41c6-8e53-75e5e2f85b82"
  "tokenType": "Bearer"
  "expiresIn": 1800
}

Create MongoDB wallet

This might be useful for people that do not wish to store their tokens on a flat file in local storage. For example, a service that runs on multiple servers might wish to use the same bearer token across all instances, so they could all use a shared token wallet.

I imagine this being a massive overkill for the majority of use cases (after all, a round-trip to a remote database might be as expensive as requesting a new bearer token every time), but I wanted to discuss the idea and explore different token storage solutions, to see if people have a need for them.

(NodeJS) Error when wallet directory doesn't exist

When the wallet directory doesn't exist, the app crashes with a ENOENT error:

{ [Error: ENOENT: no such file or directory, open '/Users/eduardoboucas/Sites/api-wrapper/.wallet/token.http-localhost3014.worker.json']
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/eduardoboucas/Sites/api-wrapper/.wallet/token.http-localhost3014.worker.json' }

We need to ensure the directory is created at runtime.

Deprecated: http2

The http2 module used in Passport (Node.js) is reported as deprecated when installing DADI Web 4.x.

npm WARN deprecated [email protected]: Use the built-in module in node 9.0.0 or newer, instead

We're not using HTTP2 just yet - I wonder if this is something we need to address in Passport?

Error responses

We have at least two error cases to handle, to match the existing auth token request in Web:

  1. an invalid set of credentials
  2. failed token request, due to incorrect uri or general network error

Currently in Web these are handled as follows:

  1. Invalid Credentials
var err = new Error('Authentication');
err.message = 'No token received, invalid credentials.';
err.remoteIp = options.hostname;
err.remotePort = options.port;
err.path = options.path;
  1. Invalid URI / network error
var err = new Error('Authentication');
err.message = "Couldn't request accessToken";
err.remoteIp = options.hostname;
err.remotePort = options.port;
err.path = options.path;

Currently in Passport I get an unhandled exception response if the credentials are incorrect. In some of the other apps we've started to use the JSON API spec for errors. Could we look at returning an errors collection in passport also?

For example:

{
  "errors": [
    {
      "status": "Not Found",
      "code": "",
      "title": "URL Not Found",
      "details": "The request for URL '<url>' returned a 404."
    }
  ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.