どこからでもQuickBooksからQuickBooksデスクトップに接続しようとしていますが、QuickBooksDesktopインスタンスであるJoe'sTestCompanyが表示されません。QuickBooksOnlineインスタンスのみが表示されます。
問題は私のURLだと思います:
https://qbo.intuit.com/qbo1/rest/user/v2/
QuickBooks DesktopのベースURLは何ですか?
これが私のコードです:
public void GetAccessTokenAndSecret()
{
string oauth_callback_url = HttpContext.Current.Request.RawUrl;
oauth_callback_url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + oauth_callback_url;
string consumerKey = _qboSettings.ConsumerKey;
string consumerSecret = _qboSettings.ConsumerKeySecret;
var oauthLink = Constants.OauthEndPoints.IdFedOAuthBaseUrl;
IToken token = (IToken)HttpContext.Current.Session["requestToken"];
IOAuthSession session = CreateSession();
IToken requestToken = session.GetRequestToken();
HttpContext.Current.Session["requestToken"] = requestToken;
string RequestToken = requestToken.Token;
string TokenSecret = requestToken.TokenSecret;
oauthLink = Constants.OauthEndPoints.AuthorizeUrl + "?oauth_token=" + RequestToken + "&oauth_callback=" + UriUtility.UrlEncode(oauth_callback_url);
HttpContext.Current.Response.Redirect(oauthLink);
}
/// <summary>
/// Creates Session
/// </summary>
/// <returns>Returns OAuth Session</returns>
protected IOAuthSession CreateSession()
{
OAuthConsumerContext consumerContext = new OAuthConsumerContext
{
ConsumerKey = _qboSettings.ConsumerKey,
ConsumerSecret = _qboSettings.ConsumerKeySecret,
SignatureMethod = SignatureMethod.HmacSha1
};
return new OAuthSession(consumerContext,
Constants.OauthEndPoints.IdFedOAuthBaseUrl + Constants.OauthEndPoints.UrlRequestToken,
Constants.OauthEndPoints.IdFedOAuthBaseUrl,
Constants.OauthEndPoints.IdFedOAuthBaseUrl + Constants.OauthEndPoints.UrlAccessToken);
}
これが私の定数です:
using System.Globalization;
namespace HelloIntuitAnywhere.Utilities
{
using System.Configuration;
using System.Web;
/// <summary>
/// Contains Constants.
/// </summary>
internal class Constants
{
static string Url_Request_Token = "/get_request_token";
static string Url_Access_Token = "/get_access_token";
static string Intuit_OAuth_BaseUrl ="https://oauth.intuit.com/oauth/v1";
static string Intuit_Workplace_AuthorizeUrl = "https://workplace.intuit.com/Connect/Begin";
static string BlueDot_AppMenuUrl = "https://workplace.intuit.com/api/v1/Account/AppMenu";
static string DisconnectUr = "https://appcenter.intuit.com/api/v1/Connection/Disconnect";
static string oauth_callback_url = HttpContext.Current.Request.RawUrl.Replace("Configure", "OAuthHandler");
static string menuProxy = "MenuProxy.aspx";
static string grantUrl = "OauthGrant.aspx";
static string qbo_base_url = "https://qbo.intuit.com/qbo1/rest/user/v2/";
static string openid_identifier = "https://openid.intuit.com/Identity-YourAppName";
/// <summary>
/// OAuth EndPoints.
/// </summary>
internal class OauthEndPoints
{
/// <summary>
/// Url Request Token
/// </summary>
internal static string UrlRequestToken = Url_Request_Token != null ?
Url_Request_Token.ToString(CultureInfo.InvariantCulture) : "/get_request_token";
/// <summary>
/// Url Access Token
/// </summary>
internal static string UrlAccessToken = Url_Access_Token != null ?
Url_Access_Token.ToString(CultureInfo.InvariantCulture) : "/get_access_token";
/// <summary>
/// Federation base url.
/// </summary>
internal static string IdFedOAuthBaseUrl = Intuit_OAuth_BaseUrl != null ?
Intuit_OAuth_BaseUrl.ToString(CultureInfo.InvariantCulture) : "https://oauth.intuit.com/oauth/v1";
/// <summary>
/// Authorize url.
/// </summary>
internal static string AuthorizeUrl = Intuit_Workplace_AuthorizeUrl != null ?
Intuit_Workplace_AuthorizeUrl.ToString(CultureInfo.InvariantCulture) : "https://workplace.intuit.com/Connect/Begin";
}
/// <summary>
/// Intuit Anywhere Endpoints.
/// </summary>
internal class IaEndPoints
{
/// <summary>
/// BlueDot Menu Url.
/// </summary>
internal static string BlueDotAppMenuUrl = BlueDot_AppMenuUrl != null ?
BlueDot_AppMenuUrl.ToString(CultureInfo.InvariantCulture) : "https://workplace.intuit.com/api/v1/Account/AppMenu";
/// <summary>
/// Disconnect url.
/// </summary>
internal static string DisconnectUrl = DisconnectUrl != null ?
DisconnectUrl.ToString(CultureInfo.InvariantCulture) : "https://appcenter.intuit.com/api/v1/Connection/Disconnect";
}
}
}