Hey, thanks everyone who replied. After further testing this issue only occurs when using axios to make the request.
Creating upload session responds with 401. Application has 'Sites.ReadWrite.All' permission.

Kieran
1
Reputation point
When I try create an upload session it fails with 401 unauthorised despite having the 'Sites.ReadWrite.All' permission. Reading the contents of the drive item does work.
const response = await axios.post(
`https://graph.microsoft.com/v1.0/users/${userId}/drive/items/${itemId}/createUploadSession`,
{
headers: {
Authorization: `bearer ${token}`,
},
},
)