title: Intuit Anywhere - Invalid Token Exception
body: <p>I am trying to pass requirement AppCenter WF 1.0. My log is here:</p>
  
  <p><a href="http://pastebin.com/jqqLWury" rel="nofollow">http://pastebin.com/jqqLWury</a></p>
  
  <p>I notice that my OauthResponse page is visited twice:</p>
  
  <p>CCC : Info 4/8/2013 2:40:22 PM OauthResponse has been visited on 4/8/2013 2:40:22 PM
  CCC : Info 4/8/2013 2:40:26 PM OauthResponse has been visited on 4/8/2013 2:40:26 PM</p>
  
  <p>The log I posted above also seems to hit my page twice.</p>
  
  <p>I try and login at <a href="https://appcenter.intuit.com/TryBuy/IA/MYID" rel="nofollow">https://appcenter.intuit.com/TryBuy/IA/MYID</a>. I receive a page asking to connect to my app. When I connect and click authorize, I am sent to myapp.com/openid and redirected to myapp.com/home/index. I receive an access token, an access token secret, and a realm. When I try to authenticate with these credentials, it fails. </p>
  
  <p><em>I notice that the app is never added to my company list of apps.</em></p>
  
  <p>I am using the Intuit Azure SDK. In my development area, are these settings correct?</p>
  
  <p><strong>App URL: myapp.com/openid</strong> </p>
  
  <p><strong>Disconnect Landing url: myapp.com/disconnect</strong> </p>
  
  <p><strong>Manage Users Url: myapp.com/OauthResponse</strong> </p>
  
  <p><strong>OpenId URL: <a href="https://www.myapp.com/openid" rel="nofollow">https://www.myapp.com/openid</a></strong> </p>
  
  <p><strong>Host Name Domain: myapp.com</strong></p>
  
  <p>I am using my development consumer key and my development consumer key secret. How come I am getting bad credentials? </p>
  
  <p>Here is my error:</p>
  
  <p>Intuit.Ipp.Exception.InvalidTokenException: Unauthorized
     at Intuit.Ipp.Exception.IdsExceptionManager.HandleException(IdsException idsException)
     at Intuit.Ipp.Core.ServiceContext.GetQBOPartitionedURL(String qboServiceEndpoint)
     at Intuit.Ipp.Core.ServiceContext.GetBaseURL()
     at Intuit.Ipp.Core.ServiceContext..ctor(IRequestValidator requestValidator, String </p>
  
  <p>Here is my code:</p>
  
  <pre><code>string Authenticate()
      {
          string accessToken = HttpContext.Current.Session["accessToken"].ToString();
          string accessTokenSecret = HttpContext.Current.Session["accessTokenSecret"].ToString();
          string companyID = HttpContext.Current.Session["realm"].ToString();
          // now auth to IA
          OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, ConfigurationManager.AppSettings["consumerKey"].ToString(), ConfigurationManager.AppSettings["consumerSecret"].ToString());
          ServiceContext context = new ServiceContext(oauthValidator, accessToken, companyID, IntuitServicesType.QBO);
          dataServices = new DataServices(context);
          return "OK";
      }
  </code></pre>
  
  <p>If I log in through my website without using that URL, everything works fine.  </p>