How does curl impersonate an OAuth authorized User Center to log in to each sub-station below it?

Source: Internet
Author: User
Tags oauth
Problem Overview:
Through PHP Curl simulation landing a website such as Http://www.aaa.com, through the Fiddler capture Packet Analysis as follows:
1. The form is submitted to Http://www.aaa.com/dologin by post, which produces a token:xxx,
2, the server with this token to jump to the following address to log in:
https://account.usercenter.com/login?token=xxx&target_url=http://www.aaa.com
(Note that the domain name is different, and is HTTPS, in addition to this token-carrying URL copy to any computer can log on, the successful landing will expire)
3. Address redirected to target_url:http://www.aaa.com after successful login

Problem Analysis:
My understanding: There is a license server, any PC computer access to carry valid tokens between the URL,PC and the server through a cookie to maintain this token;

Ask questions:
How do I implement this login simulation using PHP curl?

Here's My Code:


  

I wonder if I can make this kind of landing through cookies? Gentlemen, please advise ~ ~

Reply content:

Problem Overview:
Through PHP Curl simulation landing a website such as Http://www.aaa.com, through the Fiddler capture Packet Analysis as follows:
1. The form is submitted to Http://www.aaa.com/dologin by post, which produces a token:xxx,
2, the server with this token to jump to the following address to log in:
https://account.usercenter.com/login?token=xxx&target_url=http://www.aaa.com
(Note that the domain name is different, and is HTTPS, in addition to this token-carrying URL copy to any computer can log on, the successful landing will expire)
3. Address redirected to target_url:http://www.aaa.com after successful login

Problem Analysis:
My understanding: There is a license server, any PC computer access to carry valid tokens between the URL,PC and the server through a cookie to maintain this token;

Ask questions:
How do I implement this login simulation using PHP curl?

Here's My Code:


  

I wonder if I can make this kind of landing through cookies? Gentlemen, please advise ~ ~

The previous code I was debugging several times how to carry a cookie, but should be always not successfully associated with the cookie file, do not know how the code to write the code to carry the cookie. But later after more debugging, found that after the Http://www.aaa.com/dologin call, has been able to log on the site, this token with the URL is just a SSO, in order to login to other sub-stations.

Thank you for your answer ~ ~

Of course you can, you understand. The cookie holds a unique token, and each time it is submitted, the token is carried, and the token is invalidated immediately upon successful login.

According to the process, it must be right.

  • 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.