Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

php - Deleting an event returns success but not worked actually

I am trying to delete an event using Microsoft Graph API.

My issue is that I couldn't delete an event even the response returns success. (regarding the official doc, success returns null)

My technical stack is CakePHP v4.x and I code like the following.

$http = new Client();
$appToken = $this->getRequest()->getSession()->read('appToken');

if ($this->request->is('ajax')) {
    $this->autoRender = false;
}

$url = "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/events/{event-id}";
$response_delete = json_decode($http->delete($url, [], [
            'headers' => ['Authorization' => 'Bearer '. $appToken]
        ])->getBody()->getContents(), true);
// $response_delete = null

$appToken is the application token so a company user can delete an event.

The token works fine and also I already have the full permissions on Azure active directory.

But real strange thing is that the same code works properly on my local side.

I merged my all updated codes using Git and compared the codebase several times, but I didn't have any luck.

I am not sure why it does happen.

Thanks in advance.

UPDATE: The application token enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...