Development (8) webpage authorization (Oauth) get user information through Oauth, oauth user information
Author: Songyang
This article is from Ashura road and is prohibited for commercial purposes. For more information, see the source.
Link: http://blog.csdn.net/fansongy/article/details/45340951
Webpage authorization
During development, we al
Recently, open platforms have become very popular. Internet companies have launched their own open platforms, followed by the popular openid. oauth has become the main technology for authentication and authorization. This document takes logon to Sina Weibo for authorization to obtain user data as an example to briefly study the use of oauth. (Oauth wiki ). Curren
The main process of OAuth Authentication and storage on Sina Weibo is detailed, and oauth is detailed. The main process of OAuth Authentication and storage on sina Weibo is described in detail. oauth is described in many articles about OAuth on the Internet, but sina itself
OAuth and oauth
1. Background of OAuth generation
With the development of the Internet, some Internet giants have accumulated massive amounts of users and data. For platform-level software vendors, the user needs are diverse and varied. The varied demands are fully met by one's own efforts, and it is inevitable that they are exhausted by their own lives. Therefo
PHP version QQ internet OAuth sample code sharing, oauth sample code. The PHP version of QQ internet OAuth sample code is shared. the oauth sample code is widely used by QQ users in China, so all major websites are providing QQ login ports as much as possible. let's take a look at the php version, PHP version QQ interc
I learned how to call oauth authorization to obtain data. This article describes how to enable oauth authorization and control server data access. [Download source code]First look 1:
There were too many things in the past two days, and the articles were sorted out intermittently.
OK. Proceed to the topic. Here we still need to use the devdefined. oauth framework
Details on the OAuth authentication and Storage Processes on Sina Weibo and oauth
There are a lot of articles on OAuth on the Internet, but sina itself is not described in detail, including the verification process and storage of verified data, therefore, I wrote some detailed comments to the Twitter authentication process.
Before we start, we first create a data
The specific cause of this problem is generally the following two points:
1. In the authorized section we generally authorize by using our own login action HTTP BASIC, while we use spring security only exposed the login interface, which means that the other interfaces are in spring Security protection, including the/oauth interface.
2. Use/oauth/authorize?grant_type=passwordusername=userpassword=pwdclient_i
token value
Oauth_verifier
True
Verification Code
use authorized request token for access token
Interface Address:
Supported formats: OAuth HTTP standard authentication return format
HTTP request method: Get/post
Whether you need to sign in: No
Request Parameters:
parameter name
required
meaning
oauth_consumer_key
true
api
OAuth Authorization: Is a third party can be allowed to contact the user's account password while the third party program authorization.How to do Sina OAuth authorization:1, become a Sina developer (join)Sign in with your Sina Weibo account: open.weibo.com Sina open Platform2, create application (get ID card)Click the Create App button on the homepage, fill in the Application name/address/category/platform,
PHP version QQ interconnection OAuth sample code sharing, oauth sample code
Due to the universality of QQ users in China, all major websites now provide QQ login ports as much as possible. Let's take a look at the php version for your reference.
/*** QQ Internet oauth * @ author dyllen **/class Oauth {// obtain Authori
Scribe here refers to the oauth library, the Project address: https://github.com/fernandezpablo85/scribe-java, not the Facebook one (https://github.com/facebook/scribe ).
Oauth1.0a \ oauth2.0 is supported. I personally feel very good.
The usage is actually very simple. You can check the official website. The Sina Weibo request instance is attached here:
package com.yfz;import java.util.*;import org.scribe.builder.*;import org.scribe.builder.api
unauthorized token value
Oauth_verifier
True
Verification Code
use authorized request token for access token
Interface Address:
Supported formats: OAuth HTTP standard authentication return format
HTTP request method: Get/post
Whether you need to sign in: No
Request Parameters:
parameter name
required
meaning
oauth_consumer_key
tru
Understanding OAuth 2.0, Understanding oauth2.0
OAuth is an open network standard for licensing (authorization) that is widely used worldwide and is currently available in version 2.0.
This paper makes a concise and popular explanation for the design idea and running flow of OAuth 2.0, and the main reference material is RFC 6749.
First, the application scenari
token. const keys = Require (/config/keys ');p assport.use (new googlestrategy ({ clientid:keys.googleclientid,clientsecret: Keys.googleclientsecret,callbackurl: '/auth/google/callback '} , (Accesstoken, Refreshtoken, profile, done) = {console.log (Accesstoken)});
Finally we need to add a route handler to receive the user login request and enter the Google OAuth process, as shown in the following code.
First explain the
.
POST /token HTTP/1.1 Host: server.example.com Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Content-Type: application/x-www-form-urlencoded grant_type=passwordusername=johndoepassword=A3ddj3w
In step C, the authentication server sends an access token to the client. The following is an example.
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token":"2YotnFZFEjr1zCsicMWpAA",
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Content-Type: application/x-www-form-urlencoded grant_type=passwordusername=johndoepassword=A3ddj3w
In step C, the authentication server sends an access token to the client. The following is an example.
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token":"2YotnFZFEjr1zCsicMWpAA", "token_type":"example", "expires_in":3600, "
","Expires_in": 3600,"Refresh_token": "Tgzv3jokf0xg5qx2tlkwia","Example_parameter": "Example_value"}In the above code, the meaning of each parameter is described in the "Authorization Code mode" section.The client must not save the user's password throughout the process.IX. Client ModeClient Credentials Grant means that the client authenticates to the "service provider" on its own behalf, rather than on behalf of the user. Strictly speaking, the clien
-urlencoded grant_type=passwordusername=johndoepassword=A3ddj3w
In the C step, the authentication server sends an access token to the client, and here is an example.
http/1.1 OK content-type:application/json;charset=utf-8 Cache-control:no-store Pragma:no-cache {:" 2YOTNFZFEJR1ZCSICMWPAA " , "Token_type" : "example" Span class= "token punctuation", :3600 "Refresh_token" : "Tgzv3jokf0xg5qx2tlkwia" "Example_parameter" : "Example_ Value "}
In the above code, the
Understanding OAuth 2.0First, the application scenarioTo understand the application of OAuth, let me cite a hypothetical example.There is a "cloud printing" of the site, you can store users in Google Photos, print out. In order to use the service, the user must have "cloud print" read the photos that they have stored on Google.The problem is that Google agrees to "cloud print" to read the photos only if it
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.