IOS development-Stage 3-Sina Weibo (1) documentation, stage 3 of ios

Source: Internet
Author: User
Tags oauth

IOS development-Stage 3-Sina Weibo (1) documentation, stage 3 of ios

0 https://itunes.apple.com/cn/app/you-dao-ci-dian/id491854842? Mt = 12 id1_54842 this is also called the Apple ID, which is different from the apple id used for downloading an AppStore (the account used for downloading)

 

Register Sina mail

Register Sina Weibo

Open Platform becomes a developer

 

Register an account

Enter developer information when creating an app mobile app

The basic information is displayed after the basic information is filled in after the new application is created.

 

Record:

App Key: 3744355969

App Secret: f4cd173c39d67d3f3fef43d5c63fe9c0

 

Advanced Information

OAuth2.0 authorization settings

Authorization callback page when you authorize your application, the open platform calls back the address you entered

Cancel authorization callback page when a user cancels authorization for your application on the my application management page, the open platform calls back the address

Http://www.zhiyou100.com

 

2. OAuth2.0 authorization process

 

If a student (a third-party application) wants to take a leave of absence, he/she needs to write a ticket (loading the authorization page), sign the form (agree to authorize) with the class teacher, and sign the instructor (authentication code ), school Stamp (obtain access token)

 

Flowchart:

Client refers to a third-party application, Resource Owner refers to the user, Authorization Server is Sina's Authorization Server, and Resource Server is the Resource Server.

 

The purpose of authorization authentication is to use a series of process apps to access user information on the resource server.

Sina has OAuth Mechanism

 

The APP wants to access resource 0 on the resource server.

A: The APP sends an authorization request to the user (when the user clicks share, an interface is provided for the user to log on and authorize)

B: The user authorizes the APP (the user logs on and authorizes the APP to obtain the verification code)

C: The APP requests Access Token from the authorization server (the APP uses the verification code to request Access Token)

D: The authorization server returns the Access Token to the APP (the authorization server returns the Access Token)

E: the APP submits the Access Token to the resource server (the APP uses the Access Token to Access the resource server)

The resource server provides protected information to the APP (all your information is verified on the resource server and the access token is provided to the APP)

 

 

Code implementation process:

Create webView settings proxy Implementation Protocol Method

First, access the authorization interface oau22.

Https://api.weibo.com/oauth2/authorize? Client_id = 1514930435 & redirect_uri = http://www.zhiyou100.com & display = mobile

Build request

WebView Loading

User Logon

When the Protocol method is about to start loading a request

Returns an authorized connection click authorization.

The authorization server returns a connection that contains (redirect_uri + code)

After authorization is complete, run shouldStartLoadWithRequest to check whether the code is returned.

Build a request based on code

Obtain the access token in the request end Method

 

OAuth

The OAuth Protocol provides a secure, open, and simple standard for user resource authorization. Unlike the previous authorization method, OAUTH does not allow a third party to access user account information (such as user name and password ), that is, a third party can apply for authorization of the user's resources without using the user name and password. Therefore, OAuth is secure.

 

For example, the handsome APP needs to access the handsome user's resources Sina

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.