MrHuo. OAuthLoginLibs social login component Github, githuboauth
Blog written today
[Original] Old repeat: only configure parameters for oau2logon
It attracted greetings from many friends in the garden, so today I spent some time organizing the code.
Released to github:
MrHuo. OAuthLoginLibs: https://github.com/mrhuo/MrHuo.OAuthLoginLibs
MrHuo. OAuthLogin. QQApis: https://github.com/mrhuo/MrHuo.OAuthLogin.QQApis
OAuthLoginDLLs in the MrHuo. OAuthLoginLibs project is the latest compiled dll.
You are welcome to work together to make this component go further.
Let's talk about the code structure:
I. Reference:
RestSharp is used in the Code for network access.
About RestSharp introduction can see (good friend Brother) This article: http://www.cnblogs.com/shanyou/archive/2012/01/27/RestSharp.html
The Code uses DynamicJson for Json parsing. Why choose this component because it can serialize an object as dynamic without creating a new object.
------------------------------- Metriccut line -----------------------------------------
Ii. Code diagram:
We can see that the core is interfaces and core. This version contains resource files in simplified Chinese, traditional Chinese, and English.
------------------------------- Metriccut line -----------------------------------------
Let's look at the code diagram of the core assembly:
1. AuthStateManager maintains an internal state machine, in order to verify the status that each OAuth verification brings to a third-party platform.
2. AuthConfigManager manages configured configuration files.
3. OAuthToken is a general Token base class that can be expanded based on different platforms. Currently, no changes are required.
4. OAuthLoginResult is the OAuth verification result class.
5. OAuthContextBase <TOAuthToken, TUserInfo> is the context for Obtaining user information and is an abstract class.
For more information, see MrHuo. OAuthLogin. QQApis.
6. The core class is OAuthLogin. You only need to use this class to perform OAuth login.
I cut a picture in the Object Browser:
------------------------------- Metriccut line -----------------------------------------
3. For the code, refer to the article in the document header.
See the effect:
1. QQ Logon:
2. Sina effect:
3. Baidu effect:
I have not applied for a suitable key for other logins, so I cannot know what the result is. I also ask all garden friends in the garden to verify and tell me.
4. In fact, the OAuth login is not complete yet. The next step is to save the obtained user's openid to the database and create a website user and bind the openid.
The next work depends on everyone. I hope you will like this component. Just fork it.
Contact: http://www.mrhuo.com
Qq: 491217650