title: Getting "invalid_grant" error when exchanging a refresh token for an access token
body: <p>I've seen this issue in a lot of questions, but so far, none seem to apply to my situation.</p>
  
  <p>The problem we are having is we are getting an "invalid_grant" error when we attempt to get an access token. This only happens to some accounts, but when it does happen, in every case I looked at, the refresh token worked before, and now has stopped working. This is happening far to frequently for it to be customers revoking access (seems to be nearly 20% of the channels we manage in the last couple weeks have been invalidated).</p>
  
  <p>As a note, we have a backend process that uploads the videos to our customer's YouTube channels.</p>
  
  <ol>
  <li><p>We use OAuth2 to get a refresh token, here are the parameters we send...</p>
  
  <p>scope = "<a href="https://www.googleapis.com/auth/youtube" rel="nofollow">https://www.googleapis.com/auth/youtube</a>",
  client_id = "",
  response_type = "code",
  access_type = "offline",
  approval_prompt = "force",
  redirect_uri = "<a href="http://www.us.com/OAuth/YouTube" rel="nofollow">http://www.us.com/OAuth/YouTube</a>"</p></li>
  </ol>
  
  <p>NOTE: for client_id we use the email address that is in the Google API manager (or was, I just looked and it is no longer there). We used to use the client ID from this page, but that caused us problems as well. Did this change? Should we be using the client ID from this page now?</p>
  
  <ol start="2">
  <li><p>We exchange the code that is returned for a refresh and access token and store the refresh token in our database. </p></li>
  <li><p>The backend process exchanges the refresh token for an access token and this is where we seem to be getting the "invalid_grant" error. </p></li>
  </ol>
  
  <p>Guaranteed only a single access token for the channel is in use at any time (25 limit doesn't apply). We don't store the access token, we get a fresh one every time we process a channel. </p>
  
  <p>Any ideas what might be happening? Something to look for? See note above about client ID. This might have something to do with it, but I'm hesitant to try it since using the "Client ID" from the API manager caused problems before.</p>