Code Monkey home page Code Monkey logo

rest's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rest's Issues

Set tokens in cookies improvement [ help needed ]

Hi! I need, for my project to use cookie based token storage.
Indeed, I want to be able to authenticate the user in the first request, so I can achieve SSR with restricted data.

How do you recommand to edit the rest API in order to do so?

I was thinking about turning this :

res.json(objectContainingTokens)

into this :

res.Cookie('access-token', tokens.accessToken, {httpOnly:true, secure:true, maxAge:172800} )
res.Cookie('refresh-token', tokens.refreshToken, {httpOnly:true, secure:true, maxAge:1296000000} )
res.json(objectWithoutTokens)

Which other package will I need To edit?

Thank you

How to get accessToken when using OAuth?

In one of the alphas we use, the OAuth provider is a bit different from the current.
There is a code that exposes the OAuth access token using a the req.session.grant.response.access_token and then the provider can verify it.
I tried to update to the latest beta (2) now, but my OAuth provider does not get the accessToken (in authenticate callback).

Maybe we need to allow the developer to expose a custom method that transforms req to params?

Or maybe we can expose the session from req here?

@davidyaha @pradel

No Error codes in responses

The current implementation only returns an object like this:

{
  "message": "User not found"
}

This is not really nice to process, since there's no easy way to identify what went wrong. An error-code would be good.

{
 "errorCode": "userNotFound",
 "message": "The User requested was not found"
}

Change current rest endpoints to REST Api style

For resource user

  • Change POST - getUser to GET - user
  • Change POST - createUser to POST - user

For resource session

  • Change POST - loginWithPassword to POST login
  • Change POST - refreshTokens to UPDATE session/tokens

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.