InvalidAuthenticationToken and CompactToken issues - Microsoft Graph using PHP Curl

后端 未结 1 1328
失恋的感觉
失恋的感觉 2021-01-28 15:25

I\'m able to successfully fetch an access_token from having the user login via oauth (parameter: code) etc. However, each time I attempt to post the authorization header (via ph

相关标签:
1条回答
  • 2021-01-28 16:21

    This error is apparently due to sending the OAuth token as OAuth instead of Bearer in the curl request.

    This triggered the above error:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: application/json',                                                                                
        'Content-Length: 0',
        'Authorization: OAuth '.$token)                                                                       
    );        

    This yielded the successful response:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: application/json',                                                                                
        'Content-Length: 0',
        'Authorization: Bearer '.$token)                                                                       
    );        
    0 讨论(0)
提交回复
热议问题