Open hosseinab opened 6 years ago
Yes, it's possible. If you can able to integrate two functions. sending verification code and confirming verification code. or you can save cookies on cookie jar from this library and use it with mgp25. Make sure you use correct file name structure according to mgp25 and location too.
Do you have a sample code for this ?
When I send the activation code to the server and receive a response to the correct code. What should I do to save the session? (in mgp25 library)
I will provide a sample if I create one in future for mgp25.
hi I wrote these three functions for mgp25 library :
1- function for send get to checkpoint url :
` public function checkpoint( $url ,$appRefreshInterval = 1800) { if (empty($url)) { throw new \InvalidArgumentException("You must provide a url to checkpoint."); }
try {
$response = $this->request($url)
->setNeedsAuth(false)
->getRawResponse();
} catch (\InstagramAPI\Exception\InstagramException $e) {
functions::dd($e->getMessage());
return $e->getMessage();
}
return $response;
}`
2- function for select verification method and send code ` public function sendVerificationCode( $url, $method) { if (empty($url)) { throw new \InvalidArgumentException("You must provide a url to checkpoint."); }
try {
$token = $this->client->getToken();
$response = $this->request($url)
->setNeedsAuth(false)
->addHeader("x-instagram-ajax" , true)
->addHeader("referer" , $url)
->addHeader('x-csrftoken', $token)
->addParam("choice", $method)
->addPost("choice", $method)
->addUnsignedPost("choice", $method)
->getResponse(new Response\LoginResponse());
\Yii::$app->session->set('cookie', $token);
} catch (\InstagramAPI\Exception\InstagramException $e) {
functions::dd($e->getMessage());
return $e->getMessage();
}
return $response;
}
3- function for send code
public function ConfirmVerificationCode(
$url,
$code)
{
if (empty($url)) {
throw new \InvalidArgumentException("You must provide a url to checkpoint.");
}
try {
$response = $this->request($url)
->setNeedsAuth(false)
->addHeader("x-instagram-ajax" , true)
->addHeader("referer" , $url)
->addHeader("x-csrftoken", \Yii::$app->session->get('cookie'))
->addParam("security_code", $code)
->addPost("security_code", $code)
->addUnsignedPost("security_code", $code)
->getRawResponse();
} catch (\InstagramAPI\Exception\InstagramException $e) {
functions::dd($e->getMessage());
exit();
return $e->getMessage();
}
functions::dd($response);
return $response;
}`
function 1 and 2 works correct , but three function not get correct response :
'{\"message\": \"\", \"challenge\": {\"challengeType\": \"SelectVerificationMethodForm\", \"errors\": [\"This field is required.\"], \"experiments\": {}, \"extraData\": {\"__typename\": \"GraphChallengePage\", \"content\": [{\"__typename\": \"GraphChallengePageBanner\", \"banner_text\": \"Suspicious Login Attempt\"}, {\"__typename\": \"GraphChallengePageHeader\", \"description\": null, \"title\": \"We Detected An Unusual Login Attempt\"}, {\"__typename\": \"GraphChallengePageText\", \"alignment\": \"center\", \"html\": null, \"text\": \"To secure your account, we\'ll send you a security code to verify your identity. How do you want to receive your code?\"}, {\"__typename\": \"GraphChallengePageForm\", \"call_to_action\": \"Send Security Code\", \"display\": \"inline\", \"fields\": [{\"__typename\": \"GraphChallengePageFormChoiceField\", \"input_name\": \"choice\", \"input_type\": \"choice\", \"values\": [{\"label\": \"Email: k****s@i*****.ir\", \"selected\": true, \"value\": 1}, {\"label\": \"Phone: +98 *** *** **41\", \"selected\": false, \"value\": 0}]}], \"href\": null}]}, \"fields\": {\"choice\": \"1\", \"fb_access_token\": \"None\", \"big_blue_token\": \"None\", \"google_oauth_token\": \"true\", \"email\": \"k****s@i*****.ir\", \"phone_number\": \"+98 *** *** **41\"}, \"navigation\": {\"forward\": \"/challenge/5591131890/D0CXOE8hwi/\", \"replay\": \"/challenge/replay/5591131890/D0CXOE8hwi/\", \"dismiss\": \"instagram://checkpoint/dismiss\"}, \"privacyPolicyUrl\": \"/about/legal/privacy/\", \"type\": \"CHALLENGE\"}, \"status\": \"fail\"}'
please help me . thanks
You need to save cookies from first step and use it on second, third step.
thanks for answer . save the cookies in step 2 in session : \Yii::$app->session->set('cookie', $token);
read the cookies in step 3 : ->addHeader("x-csrftoken", \Yii::$app->session->get('cookie'))
you need to save cookies on cookie jar when using curl.
What to do? please help me to save cookies
Sorry, did not create this sample?
Very good. Wait
plz help me
Hi, @hosseinab I don't have the example for mgp25. if I create one, I will post an update. Please see the example, understand the flow. You can apply flow on Yii.
Hi @hosseinab , you will get all you want from this library and it's suitable for mgp25.
https://github.com/danleyb2/Instagram-API-php
composer require mgp25/instagram-php dev-master
This is old version. I want a new version of this library. thanks
Use the dev-master when you pull mgp25
On Thu, 5 Jul 2018, 13:00 hossein ahmadzadeh, notifications@github.com wrote:
This is old version. I want a new version of this library. thanks
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/muthu-kc/php-instagram-private-api-with-checkpoint-feature/issues/3#issuecomment-402631079, or mute the thread https://github.com/notifications/unsubscribe-auth/AHjnGNtkq6raqY1OGfBt93t_8wMGMsdpks5uDcCSgaJpZM4UejUc .
i use dev master . I do not understand what you mean
Hello! I would like to do this in mgp25, could you help me?
I am working on mgp25 checkpoint issue. I will update once it's done.
I'm interested in using mgp25 but the checkpoint problem in it for me is still a problem.
@muthu-kc any good news?
Hello Guys, I have been working on mgp25 for almost two days and I wrote a class for mgp25 to solve checkpoint issue. It's working and have to make minor changes I will test it and post an update here. Anybuddy willing to get paid version?
Please help us share the mgp25 version
@muthu-kc how can i solve mgp25
repository?
hi . Is there a way to use this way in the mgp25/Instagram-API library for checkpoint? best regards