. Net core jwt entry record, corejwt

Source: Internet
Author: User

. Net core jwt entry record, corejwt

I searched a lot of jwt articles from Baidu search and wrote a demo with the article. Here I will record the problems encountered during the learning process. If you read the article multiple times, it is better to manually implement it once.

The template has been uploaded to github.com: dogvane/webapi_effect_template

Let the project fly first

Only Articles and code snippets are available on the Internet. The articles and code snippets found in github are either unable to run (other Dependencies to be configured, databases, and so on), or the code structure is extremely complicated and I don't know where to change them.

For the demo, only two functions are required.

1. Generate the jwt token and return it to the front-end (AccountController. Login)

2. Execute a business method that requires permission and obtain the user ID (AccountController. DoYourTask) in it)

Note:

 

Generate the token code, if the issuer information and startup. inconsistency in cs cannot be verified, especially when your code is copied from two places (do not ask me how to know o (> unknown <) o ).

Therefore, a website that parses jwt information is very important online parsing jwt parameter http://jwt.calebb.net/

During the test, swagger is used to enable the swagger ui request to carry header information.Https://www.cnblogs.com/JacZhu/p/6188968.html

You can understand why UserId should be parsed in BaseController. I have found many articles at the beginning. None of them refer to how to parse data from jwt. It has been a long time since my mind has not been transferred.

In fact, you can find out from another angle. You don't need to find any articles. token can be obtained from the Request. The jwt processing class has been added to the system. You just need to check the api. Therefore, it is better to read a hundred articles.

Add several keywords to facilitate the search:. net core jwt Decode userid



 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.