Answer the question
In order to leave comments, you need to log in
How to make an authorization through instagram?
Hello. I'm trying to login to a website with instagram. I do something like in this article: https://php-academy.kiev.ua/blog/pokorenie-instagr...
And so. i have a button:
<a href="https://api.instagram.com/oauth/authorize?client_id=<?=IDINS?>&redirect_uri=<?=URLINS?>&scope=basic&response_type=code">Instagram</a>
<?php
$app->get('/login', function () use ($app, $client) {
$data = array();
$login_url = '';
if($app->request->get('code')){
$code = $app->request->get('code');
$response = $client->post('https://api.instagram.com/oauth/access_token', array('body' => array(
'client_id' => IDINS,
'client_secret' => SECRETINS,
'grant_type' => 'authorization_code',
'redirect_uri' => URLINS,
'code' => $code
)));
$data = $response->json();
}else{
$login_url = "https://api.instagram.com/oauth/authorize?client_id=IDINS&redirect_uri=URLINS&scope=basic&response_type=code";
}
$app->render('home.php', array('data' => $data, 'login_url' => $login_url));
});
?>
Answer the question
In order to leave comments, you need to log in
Did you notice that the example is designed for the Slim framework?
I don’t see in the code
a) composer autoload
b) $app initialization by slim
https://gist.github.com/anonymous/6516521b1fb3b464...
https://core.telegram.org/widgets/login
https://telegram.org /blog/login
from February 6 simplified
You haven’t created an APP anywhere, let alone defined it, try reading a php book for idiots to get started
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question