Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,241 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Use different accounts to call the same OneDrive graph API and other parameters (such as client_ID, client_secret) are same,
Account "A" will fail at Step 3, and Account "A" was created before 2019/11,
Account "B" will all succeed and Account "B" was created recently.
Account "A" and "B" can use OneDrive on the web and they are all personal accounts.
Request:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=653c1.....&response_type=code&redirect_uri=http://localhost:53511/cloud&response_mode=query&scope=Files.ReadWrite+offline_access
Redirect:
http://localhost:53511/cloud?code=M.C558_BL2.2.U.be6bddb7-edac-688f-b6d6-f76890c6aad8
POST /common/oauth2/v2.0/token HTTP/2
Host: login.microsoftonline.com
user-agent: curl/7.81.0
accept: */*
content-type: application/x-www-form-urlencoded
content-length: 258
client_id=653c1... scope=Files.ReadWrite+offline_access code=M.C558_BL2.2.U.... redirect_uri=http://localhost:53511/cloud grant_type=authorization_code client_secret=yzlW82...
HTTP/2 200
cache-control: no-store, no-cache
pragma: no-cache
content-type: application/json; charset=utf-8
expires: -1
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
p3p: CP="DSP CUR OTPi IND OTRi ONL FIN"
x-ms-request-id: 8b61db84-5d4a-4a5f-99b5-31832f964300
x-ms-ests-server: 2.1.19005.8 - SEASLR1 ProdSlices
x-ms-srs: 1.P
x-xss-protection: 0
set-cookie: fpc=Agzud9KEFKNOkh2ZjZh1DBn-zW_gAQAAAJWSjN4OAAAA; expires=Wed, 30-Oct-2024 12:37:42 GMT; path=/; secure; HttpOnly; SameSite=None
set-cookie: x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly
set-cookie: stsservicecookie=estsfd; path=/; secure; samesite=none; httponly
date: Mon, 30 Sep 2024 12:37:42 GMT
content-length: 1670
{"token_type":"Bearer","scope":"Files.ReadWrite","expires_in":3600,"ext_expires_in":3600,"access_token":"EwB4A8l6BA......","refresh_token":"M.C558_BL2.0......"}
POST /v1.0/me/drive/items/root:/Scan/ttttt.jpg:/createUploadSession HTTP/2
Host: graph.microsoft.com
user-agent: curl/7.81.0
accept: */*
content-type: application/json
authorization: Bearer EwB4A8l6BAAUbDba3x2OMJE......
content-length: 157
{"item":{"@microsoft.graph.conflictBehavior":"rename","description":"","fileSystemInfo":{"@odata.type":"microsoft.graph.fileSystemInfo"},"name":"ttttt.jpg"}}
HTTP/2 400
cache-control: no-store, no-cache, max-age=0, private
content-type: application/json
strict-transport-security: max-age=31536000
request-id: 9c768b04-0dfd-41d1-a3f0-69c223536fa6
client-request-id: 9c768b04-0dfd-41d1-a3f0-69c223536fa6
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Korea Central","Slice":"E","Ring":"4","ScaleUnit":"000","RoleInstance":"SE1PEPF000092F9"}}
date: Mon, 30 Sep 2024 12:52:58 GMT
{"error":{"code":"invalidRequest","message":"Invalid request","innerError":{"date":"2024-09-30T12:52:59","request-id":"9c768b04-0dfd-41d1-a3f0-69c223536fa6","client-request-id":"9c768b04-0dfd-41d1-a3f0-69c223536fa6"}}}
POST /v1.0/me/drive/items/root:/Scan/ttttt.jpg:/createUploadSession HTTP/2
Host: graph.microsoft.com
user-agent: curl/7.81.0
accept: */*
content-type: application/json
authorization: Bearer EwB4A8l6BAAUbDba3x2OMJE......
content-length: 157
{"item":{"@microsoft.graph.conflictBehavior":"rename","description":"","fileSystemInfo":{"@odata.type":"microsoft.graph.fileSystemInfo"},"name":"ttttt.jpg"}}
HTTP/2 200
cache-control: no-store
content-type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
location: https://graph.microsoft.com
strict-transport-security: max-age=31536000
request-id: ef27052d-7cf7-4a15-97b2-a1f8af95c483
client-request-id: ef27052d-7cf7-4a15-97b2-a1f8af95c483
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Korea Central","Slice":"E","Ring":"4","ScaleUnit":"003","RoleInstance":"SE1PEPF00009317"}}
odata-version: 4.0
date: Mon, 30 Sep 2024 13:16:09 GMT
{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession","expirationDateTime":"2024-10-05T13:17:50.988Z","nextExpectedRanges":["0-"],"uploadUrl":"https://api.onedrive.com/rup/1fe3b5cce115f141/eyJSZXNvdXJjZUlEIjoiMUZFM0......"}