How to test the local third-party interface such as QQ login

Source: Internet
Author: User

Now basically a website will be integrated with some of the third-party interface, such as QQ login, sharing and so on. But in the development, especially without this experience of developers, debugging process will appear confused, do not know how to debug. Here is a summary of this aspect of personal learning and exploration.

Title, this article is just a summary of how to test the local third-party interface such as QQ login.

Special Note: 1, this article to integrate QQ login interface as an example. 2, because is the net program ape, so with the VS example to illustrate

about how to become a QQ developer, how to apply for AppID and Appkey, no longer repeat! Baidu Encyclopedia all have, also say what! hehe ~

about how to integrate, the official network has a variety of SDKs, and are open source, this down, self-learning can be, and no longer repeat!

The difference between the 3 Web servers under the net platform (①windows's own IIS Web server, ②iisexpress, and the ASP. ③visual Studio), which is self-searching, is clear, Because I also said not very specific, O (∩_∩) o~.

OK, in order to illustrate the problem, we will start from how to configure the QQ login interface "callback Address", because this is the integration after the process can walk through the joints where.

QQ Login Interface Callback Address requirements: can be filled with multiple callback address, "HTTP (s)://" Beginning, without query parameters and hash parameters. This means that the correct format should be HTTP (s)://domain or ip/callback address path, such as http://127.0.0.1/Tencent/Authorized/or http://www.woyaoceshi.com/ Tencent/authorized/is the right format, and like http://localhost/Tencent/Authorized/, it's definitely wrong, you can try it.

Then the problem is clear, if we start the VS open page directly, it must be the address of localhost, obviously not. How can it be an IP or a domain name form? Can be configured, of course.

First, if you are using the VS development Server

Right-click Project--open property page->web label

1. Set the startup URL to http://127.0.0.1

2, set the port to 80;

Special Note: Why should the port be set to 80? Because if you use a different port number, it should be displayed in the URL address, and the QQ login interface callback address can not use the port number, you can try.

Also, it is best not to use 8080, as for the difference between 80 and 8080, I also just smattering, anyway, I was in the experiment 8080 also want to show use.

Also note that if you have a Web deployed on IIS and you are using 80 or 8080 ports, you need to stop it, or the runtime will go to your web app.

Ok! Let's take a look at how to use the Domain name form.

1, open the Hosts file under C:\Windows\System32\drivers\etc, some children's shoes may open or modify this file, there will be a question of permissions, Here's a reminder: The Hosts file right-click Properties-Security-advanced to elevate the current computer user permissions.

2, open after adding a record: 127.0.0.1 www.woyaoceshi.com; So after the completion of the domain name Mapping, the above start URL can also be set to: http://www.woyaoceshi.com; Description: This domain name you write casually, here is just for example.

Friendship tip: About the role of the Hosts file, Baidu Encyclopedia has an article, said very well very clearly, I do not write down the address. also about the domain name should not www? I would like to say whether you can, but use to maintain unity , because the domain name has no www or there is a difference. As for the difference, I can not say very clearly, also in the study AH/(ㄒoㄒ)/~~

At this point, you can start the project as http://127.0.0.1 or http://www.woyaoceshi.com, and the callback address can be configured as http://127.0.0.1/Tencent/Authorized/or http:/ /www.woyaoceshi.com/tencent/authorized/, so the joints were opened.

Ii. use of IIS Express

Why use IIS Express? Because she makes up for the shortcomings of IIS and VS servers respectively. Using the VS server sometimes it's hard to test some of the problems in the online environment, and using IIS to find the problem is difficult to debug. So we have IIS Express, so we can find the problem in the online environment, and it's easy to debug.

1. Project launches IIS Express; Right-click Project--open property page->web label

1. Choose to use the local IIS Web server

2. Choose to use IIS Express

3, the configuration item URL is http://localhost; When you save the configuration, you may receive a prompt for "The local IIS Express URL that has not been configured as a Web project XXX", just click OK and let vs auto-create.

4, open c:\users\< your computer user name >\documents\iisexpress\config under the ApplicationHost, find the 3rd step in the generated site node (according to your project name), modify see the description

Add two records in the loop:

<binding protocol= "http" bindinginformation= "*:80:www.woyaoceshi.com"/>
<binding protocol= "http" bindinginformation= "*:80:127.0.0.1"/>

In this way, the project URL can be configured as http://127.0.0.1 or http://www.woyaoceshi.com in the third step, and the Web address is directly the form of an IP or domain name at startup.

Summary: It is always the third-party interface integration needs to be on-line environment to see the effect, so in the integration when the problem is found, also inconvenient debugging, through the above configuration, we also built a local testable environment.

How to test the local third-party interface such as QQ login

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.