{"action":"opened","issue":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-dotnet/issues/183","labels_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-dotnet/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-dotnet/issues/183/comments","events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-dotnet/issues/183/events","html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/183","id":69655952,"number":183,"title":"IsMRRT flag not updated correctly when server does not pass refresh token when refreshing an access token","user":{"login":"crmann1","id":12025013,"avatar_url":"https://avatars.githubusercontent.com/u/12025013?v=3","gravatar_id":"","url":"https://api.github.com/users/crmann1","html_url":"https://github.com/crmann1","followers_url":"https://api.github.com/users/crmann1/followers","following_url":"https://api.github.com/users/crmann1/following{/other_user}","gists_url":"https://api.github.com/users/crmann1/gists{/gist_id}","starred_url":"https://api.github.com/users/crmann1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crmann1/subscriptions","organizations_url":"https://api.github.com/users/crmann1/orgs","repos_url":"https://api.github.com/users/crmann1/repos","events_url":"https://api.github.com/users/crmann1/events{/privacy}","received_events_url":"https://api.github.com/users/crmann1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-20T18:54:52Z","updated_at":"2015-04-20T18:54:52Z","closed_at":null,"body":"If the server does not respond with a refresh token and we used a refresh token to get the access token the IsMRRT flag is not correctly updated. \r\n\r\nazure-activedirectory-library-for-dotnet-2.11.10918.1222\\src\\ADAL.Common\\OAuth2Response.cs \r\n                ParseTokenResponse\r\nWhen a token is requested from the server using a refresh token the response that comes back \r\ndoes not include a refresh token itself. This means that the Authentication result created has a resource but no refresh token at the point of creation. Therefore its IsMultipleResourceRefreshToken flag is false. This is then returned into SendTokenRequestByRefreshTokenAsync\r\n\r\nLater in azure-activedirectory-library-for-dotnet-2.11.10918.1222\\src\\adal.common\\acquiretokenhandlerbase.cs\r\n                SendTokenRequestByRefreshTokenAsync\r\n\r\nAfter we have finished parsing the response and getting the authentication result from parsetokenresponse there is a check to see if there is a refresh token on the result. Since this result was requested through a refresh token \r\nthe value will be null. We take the refresh token we sent with the response and set that on the refresh token property. \r\n\r\nThe problem is here\r\n\r\n           if (result.RefreshToken == null)\r\n           {\r\n                result.RefreshToken = refreshToken;\r\n           }\r\n\r\nNote that even though we set the refresh token we do not go back and set the IsMultipleResourceRefreshToken flag to true.\r\n\r\nThe code should be \r\n\r\n          if (result.RefreshToken == null)\r\n          {\r\n               result.RefreshToken = refreshToken;\r\n               result.IsMultipleResourceRefreshToken = (!string.IsNullOrWhiteSpace(result.RefreshToken) && !string.IsNullOrWhiteSpace(result.Resource));\r\n          }\r\n"}}