Micro-credit development, often have such a demand: Get the user avatar, binding micro-signal to the user to send information. So the prerequisite for achieving these is authorization!
1. Configure the security callback domain name:
Before the user's website authorization is requested by the micro-credit public number, developers need to first to the public platform in the "Development-interface permissions-Web services-Web account-Web Access authorization to obtain user information," The co
This article describes the PHP version of the micro-letter automatic login and get a nickname method. Share to everyone for your reference, specific as follows:
Micro-letter Automatic login and get nickname is through the API interface can be obtained through the micro-letter open Interface to achieve, let's take a look at an example
Record only: Micro-credit get nickname Auto Login
After several repeated verification, I found this method is flawed:
The micro-letter did not pay attention to
backstage.Mchid can be found in the message sent after the application for the micro-letter payment, KEY according to the mail prompt
To the merchant platform configuration can be.
3. Visit Start index.php
First visit index.php you can see the interface
The first thing we need is JSAPI payment. But see the code index.php the bottom link. He defaults to a demo link, instead we can customize the
Of course you can also write directly to death for your own access links.
4. JSAPI Paymen
);
}
@Override public
void Onresp (Baseresp resp) {
if (resp instanceof sendauth.resp) {sendauth.resp Newresp
= (SENDAUTH.RESP) Resp;
Get code
String code = Newresp.code}} for micro-mail
returns
Add the following code to the Androidmanifest.xml:
Copy Code code as follows:
Fix the error in the wxentryactivity, get code in the Onresp method, and get the token and OpenID via the following interf
1. Pull Access_token2. Draw User Information3. Push message actively4. Interface seems to apply for permission5. Reliance on httpclient4.2.3 and Jackson 2.2.1
Copy Code code as follows:
public class Weixinapihelper {
/**
* Get Token interface
*/
Private String Gettokenurl = "Https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credentialappid={0}" secret={1} ";
/**
* Pull micro-letter user Information interface
*/
Private String Getuserinfourl = "Https://api.weixin.qq.c
Most Web sites require users to log in.A common practice is to have users sign up for an account.This approach is not satisfactory.For the user, each site must remember a password, very troublesome, for developers, must bear the responsibility to protect the password, once the password leaks, the business and reputation of the site is a huge blow.So, long ago, people began to imagine "no password login" (password-less login). This will be a great burden on users and websites.This article reviews
Copy Code code as follows:
function Resumeerror () {
return true;
}
Window.onerror = Resumeerror;
function Showdd (obj) {
var DDS = document.getElementById (obj). getElementsByTagName ("DD");
var len = dds.length;
if (Dds[0].style.display = = "None") {
The action is to expand the menu to determine if there is a cookie in the
1, have, delete
2, no, do not perform operation
Changeshowmenu (obj);
for (var i = 0; i Dds[i].style.display = "";
}
}else{
This action is a hidden men
. Unique identification as our ID card number, we handle credit card when the identity card is required, the real name under the purchase number card, ID card is necessary. If we are the system administrator, then I can completely through your ID number to find your cell phone number, bank card number.
With the above thought, all we have to do is find a unique identifier to associate with. There is an important role for the micro-letter OpenID. It
(Application key), the micro-letter merchant number, the micro-credit payment key, and the acquisition and setup of these parameters can be read in this article http://www.jb51.net/softjc/346871.html
Second, the development process
Not much nonsense to say directly after finishing the process:
1, through the micro-letter authorization callback to obtain authorization code
2, through authorization code in exchange for Web page authorization Access_token and
Web page Production WEBJX article introduction: account number is a prerequisite for you to use the service, account numbers (user number) is more than traffic can measure a site impact indicators, so account resources have been a large number of sites as the lifeblood. Years ago, foreign support for email as a website account, from 2005 to appear OpenID, and then to 2008, 2009 Facebook Connect the most. Their purpose is to liberate
Accoun
The main purpose of this paper is to test whether a single column should be indexed, with query time and number of scanned rows as reference. MySQL version 5.5.20A: Build a tableCREATE TABLE' record ' (' ID ' )int( One) not NULLauto_increment, ' OpenID 'varchar( the) not NULL, ' tagId 'int( One)DEFAULT NULL, PRIMARY KEY(' id '),KEY' Idx_openid ' (' OpenID ') USING BTREE) ENGINE=InnoDBDEFAULTCHARSET=UTF8;Tw
Recently, some js functions have been written in the project, and the level needs to be improved.
The Code is as follows:
Function ResumeError (){Return true;}Window. onerror = ResumeError;Function showdd (obj ){Var dds = document. getElementById (obj). getElementsByTagName ("dd ");Var len = dds. length;If (dds [0]. style. display = "none "){// This operation is an expanded menu. You need to determine whether this option exists in the cookie.// 1. Yes, delete// 2. None. do not perform the oper
"; if (_ tencentOAuth. accessToken 0! = [_ TencentOAuth. accessToken length]) {// record the login user's OpenID, Token, and expiration time _ labelAccessToken. text = _ tencentOAuth. accessToken;} else {_ labelAccessToken. text = @ "failed to log on. failed to get accesstoken";} non-network error cause logon Failure: @ protocol TencentSessionDelegate
-(Void) tencentDidNotLogin :( BOOL) canceled {if (canceled) {_ labelTitle. text = @ "";}
CopyCode The Code is as follows: function resumeerror (){
Return true;
}
Window. onerror = resumeerror;
Function showdd (OBJ ){VaR DDS = Document. getelementbyid (OBJ). getelementsbytagname ("DD ");VaR Len = DDS. length;If (DDS [0]. style. Display = "NONE "){// This operation is an expanded menu. You need to determine whether this option exists in the cookie.// 1. Yes, delete// 2. None. do not perform the operationChangeshowmenu (OBJ );For (VAR I = 0; I DDS [I]. style. Display = "";}} Else {
party Web page bounce URL, first get code from the request, and then according to code further in exchange for OpenID and Access_token, and then can be based on the OpenID and Access_token invoke the relevant interface to query user information.
PHP Code
$appid = "The AppID of the public number" ;
$secret = "The app secret in the public number" ;
$code = $_get ["code"];
$get _toke
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.