Settings

Theme

Ask HN: API Authentication Using Passport.js

1 points by fuadnafiz98 4 years ago · 0 comments · 1 min read

Reader

Hello everyone. I am trying to implement API authentication in my nodejs, reactjs application using passport.js github authentication and need to clarify some confusion.

First of all, I want to authenticate my API endpoints via JWT tokens ( and not by session cookies ). So, I disabled the default `session: false`.

I created all routes `/auth/github` and `/auth/github/callback` and attached them with my react frontend.

So, it works. I am prompted with github sign-in. And github gives me my user information, access token. refresh token etc.

Now my questions are

what should I have to do next?

What informations do I need to store in my database?

Do the `accesstoken` provided by github enough for me to secure the API routes or Do I have to generate *JWT* token (with the payload provided by github) and then follow the common JWT authentication procedure?

Thank you for your time to listen to my question. I am confused about passport.js and integration between frontend and backend.

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection