{"action":"opened","issue":{"url":"https://api.github.com/repos/OneDrive/onedrive-api-docs/issues/369","repository_url":"https://api.github.com/repos/OneDrive/onedrive-api-docs","labels_url":"https://api.github.com/repos/OneDrive/onedrive-api-docs/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/OneDrive/onedrive-api-docs/issues/369/comments","events_url":"https://api.github.com/repos/OneDrive/onedrive-api-docs/issues/369/events","html_url":"https://github.com/OneDrive/onedrive-api-docs/issues/369","id":156406222,"number":369,"title":"401 Unauthorized while using \"files.readwrite\" scope","user":{"login":"Z-Jay","id":6903218,"avatar_url":"https://avatars.githubusercontent.com/u/6903218?v=3","gravatar_id":"","url":"https://api.github.com/users/Z-Jay","html_url":"https://github.com/Z-Jay","followers_url":"https://api.github.com/users/Z-Jay/followers","following_url":"https://api.github.com/users/Z-Jay/following{/other_user}","gists_url":"https://api.github.com/users/Z-Jay/gists{/gist_id}","starred_url":"https://api.github.com/users/Z-Jay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Z-Jay/subscriptions","organizations_url":"https://api.github.com/users/Z-Jay/orgs","repos_url":"https://api.github.com/users/Z-Jay/repos","events_url":"https://api.github.com/users/Z-Jay/events{/privacy}","received_events_url":"https://api.github.com/users/Z-Jay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-24T02:20:16Z","updated_at":"2016-05-24T02:20:16Z","closed_at":null,"body":"According to the [latest document](https://github.com/OneDrive/onedrive-api-docs/commit/be1cf94fd68caab3b5533f41d539d9807b6579f8#diff-3b588e04fda07b7c4f2c5b7935ef7c86), we should be able to use `files.readwrite` scope to grant read and write permission. So I used this scope with the token flow to get `access_token` like\r\n```\r\nGET https://login.live.com/oauth20_authorize.srf?client_id={client_id}&scope=files.readwrite&response_type=token&redirect_uri=https://login.live.com/oauth20_desktop.srf\r\n```\r\nI can get `access_token` with this. However when I use this `access_token` to get OneDrive resources like following:\r\n```\r\nGET /v1.0/drive/ HTTP/1.1\r\nAuthorization: bearer {access_token}\r\nHost: api.onedrive.com\r\nX-Target-URI: https://api.onedrive.com\r\nConnection: Keep-Alive\r\n```\r\nI receive a `401 Unauthorized` response.\r\n```\r\nHTTP/1.1 401 Unauthorized\r\nWWW-Authenticate:\r\nBearer realm=\"OneDriveAPI\", error=\"invalid_token\", error_description=\"Auth error\"\r\nX-MSNSERVER:\r\nBN1301____PAP115\r\nContent-Length:\r\n2730\r\nConnection:\r\nkeep-alive\r\nX-AsmVersion:\r\nUNKNOWN; 19.40.0.0\r\nServer:\r\nMicrosoft-IIS/8.5\r\nX-QosStats:\r\n{\"ApiId\":0,\"ResultType\":2,\"SourcePropertyId\":0,\"TargetPropertyId\":42}\r\nStrict-Transport-Security:\r\nmax-age=31536000; includeSubDomains\r\nDate:\r\nTue, 24 May 2016 02:04:31 GMT\r\nP3P:\r\nCP=\"BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo\"\r\nX-ThrowSite:\r\n3834.47c0\r\nX-MSEdge-Ref:\r\nRef A: 9B33493670F346F6B26FF3F38B4C5239 Ref B: C1429D68A836071E2E79E8B5A3CD20CF Ref C: Mon May 23 19:04:31 2016 PST\r\nContent-Type:\r\napplication/json\r\n\r\n{\r\n  \"error\":  {\r\n    \"code\": \"unauthenticated\",\r\n    \"message\": \"Must be authenticated to use '/drive' syntax\",\r\n    \"innererror\":  {\r\n      \"errorType\": \"client\",\r\n      \"debugMessage\": \"PassportAuthFailStorageException(PassportAuthFail): Must be authenticated to use '/drive' syntax\\r\\n\",\r\n      \"stackTrace\": \" at Microsoft.MSN.Storage.Api.CoreApi.ModelBinders.ObjectHandleModelBinder.BuildUserAlias(IVroomRequestContext vroomRequestContext, HttpRequestMessage request, String driveId) in d:\\\\dbs\\\\sh\\\\odht\\\\0523_074242\\\\cmd\\\\25\\\\server\\\\storage\\\\private\\\\API\\\\CoreApi\\\\ModelBinders\\\\ObjectHandleModelBinder.cs:line 330\\r\\n at Microsoft.MSN.Storage.Api.CoreApi.ModelBinders.ObjectHandleModelBinder.BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) in d:\\\\dbs\\\\sh\\\\odht\\\\0523_074242\\\\cmd\\\\25\\\\server\\\\storage\\\\private\\\\API\\\\CoreApi\\\\ModelBinders\\\\ObjectHandleModelBinder.cs:line 44\\r\\n at System.Web.Http.Controllers.HttpActionContextExtensions.Bind(HttpActionContext actionContext, ModelBindingContext bindingContext, IEnumerable`1 binders)\\r\\n at System.Web.Http.ModelBinding.Binders.CompositeModelBinder.BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)\\r\\n at System.Web.Http.ModelBinding.ModelBinderParameterBinding.ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken)\\r\\n at System.Web.Http.Controllers.HttpActionBinding.<ExecuteBindingAsyncCore>d__0.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()\\r\\n\\r\\n\",\r\n      \"throwSite\": \"3834.47c0\",\r\n      \"code\": \"passportAuthFail\"\r\n    }\r\n  }\r\n}\r\n```\r\nIf I change the scope to `onedrive.readwrite` like:\r\n```\r\nGET https://login.live.com/oauth20_authorize.srf?client_id={client_id}&scope=onedrive.readwrite&response_type=token&redirect_uri=https://login.live.com/oauth20_desktop.srf\r\n```\r\nEverything works well. But I noticed that the scope in the response is `scope=onedrive.readwrite%20wl.offline_access%20wl.signin%20wl.emails%20onedrive.appfolder%20wl.basic%20files.readwrite` not the `onedrive.readwrite` I've set.\r\n\r\nWhy I get `401 Unauthorized` response while using \"files.readwrite\" scope? Is the new scope can't be used now?"}}
{"actor":{"display_login":"Z-Jay"}}