title: Invalid refresh token while trying to refresh an access token on Office365 APIs
body: <p>I'm currently trying to develop a web application which syncs calendars from Office365, and so far I managed to fetch a couple of tokens from Azure's OAuth system.</p>
  
  <p>But, even though the Refresh token seems to have at least a validity period of 14days, it seems that whenever I try to refresh my Access Token, I always get the following error :</p>
  
  <pre><code>OAuth error: "AADSTS70000: Authentication failed. Refresh Token is not valid.
  Trace ID: 47836649-e160-40f0-93d1-f599caf4f665
  Correlation ID: 45714317-5a29-4242-a785-be23269acf19
  Timestamp: 2015-03-09 09:53:18Z"
  </code></pre>
  
  <p>Any ideas ? Thanks</p>
  
  <p>-- edit --</p>
  
  <p>Here is the request made to refresh the token ;</p>
  
  <pre><code>//parameters
  refresh_token={refresh_token}
  &amp;grant_type=refresh_token
  &amp;client_id={client_id}
  &amp;client_secret={client_secret}
  &amp;resource=https%3A%2F%2Foutlook.office365.com
  
  // url
  https://login.windows.net/common/oauth2/token
  </code></pre>
  
  <p>-- edit 2 --</p>
  
  <p>Here is the exact json response I'm receiving ;</p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "error":"invalid_grant",
      "error_description":"AADSTS70000: Authentication failed. Refresh Token is not valid.\r\nTrace ID: f0b5bc67-9ad5-4a75-b384-393486b31074\r\nCorrelation ID: 05af63f5-989a-4397-924f-58745c9bc964\r\nTimestamp: 2015-03-09 12:21:08Z","error_codes":[70000],
      "timestamp":"2015-03-09 12:21:08Z",
      "trace_id":"f0b5bc67-9ad5-4a75-b384-393486b31074",
      "correlation_id":"05af63f5-989a-4397-924f-58745c9bc964",
      "submit_url":null,
      "context":null
  }
  </code></pre>
  
  <p>As outlined in <a href="http://blogs.msdn.com/b/exchangedev/archive/2014/03/25/using-oauth2-to-access-calendar-contact-and-mail-api-in-exchange-online-in-office-365.aspx" rel="nofollow">http://blogs.msdn.com/b/exchangedev/archive/2014/03/25/using-oauth2-to-access-calendar-contact-and-mail-api-in-exchange-online-in-office-365.aspx</a>, it means that my refresh token is outdated... But I just generated it through the full authorization mechanism, that is what I can't understand !</p>