TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: API Authentication Using Passport.js

1 点作者 fuadnafiz98超过 3 年前
Hello everyone. I am trying to implement API authentication in my <i>nodejs, reactjs</i> application using passport.js github authentication and need to clarify some confusion.<p>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`.<p>I created all routes `&#x2F;auth&#x2F;github` and `&#x2F;auth&#x2F;github&#x2F;callback` and attached them with my react frontend.<p>So, it works. I am prompted with github sign-in. And github gives me my user information, access token. refresh token etc.<p>Now my questions are<p>what should I have to do next?<p>What informations do I need to store in my database?<p>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?<p>Thank you for your time to listen to my question. I am confused about passport.js and integration between frontend and backend.

暂无评论

暂无评论