Skip to content

Jwt auth#35

Open
dtoranzoms wants to merge 7 commits intomakingsensetraining:masterfrom
dtoranzoms:jwt-auth
Open

Jwt auth#35
dtoranzoms wants to merge 7 commits intomakingsensetraining:masterfrom
dtoranzoms:jwt-auth

Conversation

@dtoranzoms
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread cli/README.md
```

**This sub-generator was designed to be executed only once per application.**

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

this.destinationPath("package.json")
);

}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

all these files have changes compared to the originals?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All have changes, but not all are new files...
Taking the assumption that it will run immediately we download the seed, I just copied all the files to their target folder as a quick solution. We can of course improve this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ok, as we chat before, in the mean time we can implement the modifications for the files doing update

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure


//If there's no user, then we get an empty array
if (foundUser.length === 0) {
res.status(404).json({});
Copy link
Copy Markdown
Collaborator

@mravinale mravinale Oct 22, 2017

Choose a reason for hiding this comment

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

I think that non having elements, is not an error for returning 404

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, what error code do you think we can return? My intention is to return a value different than 200 so we can realize there are no results.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe 204(no content) would be more accurate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I like it !

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In my opinion, User (or any other entity, keep on mind there is a template generator) not found functionality shouldn't be part of Login/SignUp.
On the other hand, how are you going to handle token expiration?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in the other hand this would be a simple strategy (as a demo) looking for the user into the database, create a token with expiration and returning the token and maybe name and surname, or any other public information that we may need if the user is found in the database,

Copy link
Copy Markdown
Contributor

@pablomigliasso pablomigliasso Oct 23, 2017

Choose a reason for hiding this comment

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

Well, it seems to be the approach of this PR is only Login/Signup. However, to complete the whole workflow maybe you have to take on mind "User Registration" and "Forgot Password". Going back to token expiration issue, what will be the behaviour when it is expired? Redirect to login? Show an alert to notify that? Renew the token (silent mode)?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

good question, what do you think @dtoranzoms if the client in this case may show an alert in the same page, but in general how to handle the 403 error should be responsibility of each client from the BE point of view

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I really do not like either 401 nor 403 for this case. Those codes are for unauthorized (401) or for Forbidden (403). I think this case is not either case. The user just do not exist.
@mravinale regarding your question, yes. I think we should show an alert when the token expires and redirect to login when the user accepts it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As any authentication mechanism the last thing you need to do is to notify the user doesn't exist because it won't be secured at all.

@pablomigliasso
Copy link
Copy Markdown
Contributor

pablomigliasso commented Oct 23, 2017

@dtoranzoms If you have a chance please take a look to this repos:
https://github.com/BosNaufal/secure-local-storage
https://github.com/softvar/secure-ls

I'd always want to add security to localStorage in some way. If you think it is interesting and you have enough time please go ahead. Thanks!!!!

@mravinale mravinale removed the request for review from juampick February 13, 2018 14:49
@mravinale mravinale assigned noeliasfranco and unassigned juampick Feb 13, 2018
@mravinale mravinale removed the request for review from pablomigliassoms February 13, 2018 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants