Partage
  • Partager sur Facebook
  • Partager sur Twitter

LinkedIn sign in

obtenir email

Sujet résolu
    13 mars 2020 à 12:11:34

    (php, oauth2, curl)
    Hello, I'm working on a sign in with LinkedIn. I finally just need firstname, lastname and email.
    I use oauth2, obtain the code with which i obtain the access token. I want to obtain email first.
    The answer is a 404 one :
    {"serviceErrorCode":65604,"message":"Empty oauth2 access token","status":401}  
    My code is :
    $link = 'https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))';
    
    $headercurl = array(
     'Connection' => 'Keep-Alive',
     'Authorization' => 'Bearer '.$token
    );
    
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_POST, false);
    curl_setopt($curl, CURLOPT_HTTPGET, true);
    curl_setopt($curl, CURLOPT_URL, $link);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headercurl); 
    curl_setopt($curl, CURLOPT_COOKIESESSION, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $return = curl_exec($curl);
    curl_close($curl);
    
    
    But the $token being the real access_token I receive after i give the code. I verified.
    I'm totally blocked, thank you for your help
    I decided to use file_get_contents(), it is working

    -
    Edité par LandryToucourt 13 mars 2020 à 13:32:06

    • Partager sur Facebook
    • Partager sur Twitter

    LinkedIn sign in

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown