[英]How to combine Json Web Token(JWT) and google oauth using passportjs, passport-google-oauth and node to create social login system?
I need a working example tutorial. 我需要一个工作示例教程。 I understand the concept of JWT well.
我非常了解JWT的概念。 I want to learn to implement JWT with Google oauth login.
我想学习用Google oauth登录实现JWT。
I can't find any concise, clear, and complete tutorial. 我找不到任何简明,清晰和完整的教程。 Please refer me books, tutorials, or examples.
请参考我的书籍,教程或示例。
该参考资料说明了您想使用node和express来实现的所有内容
The basic work-flow : 基本工作流程 :
first when the user login you generate a token consisted of specific signature for example a string of hashed ( user_id + 'random_string' ) and save it into your database. 首先,当用户登录时,您会生成一个由特定签名组成的令牌,例如一个哈希字符串(user_id +'random_string'),并将其保存到数据库中。
then send the generated token with header for example 然后发送带有标题的生成令牌,例如
'x-auth': generatedToken
after that whenever user makes a request you need to check for the request's header if it contains 'x-auth' header if so you check if this 'x-auth'
matches the one in your database. 此后 ,每当用户发出请求时,您都需要检查请求的标头(如果它包含“ x-auth”标头),因此,您需要检查此
'x-auth'
与数据库中的标头匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.