掌握Quickbooks Hello World应用程序,一切正常,但我有一个我认为很简单的问题

问题描述 投票:0回答:2

在application.properties中,我需要设置OAuth2密钥...

OAuth2AppClientId=AB............................AN

OAuth2AppClientSecret=br................................u8

OAuth2AppRedirectUri=http://localhost:8085/oauth2redirect

最初,我将键放在“”引号中,假设它们应被视为字符串,但要使其正常工作,我必须将其删除。有人可以解释怎么回事

OAuth2AppClientId=AB............................AN when I build the app 

以及如何找到有关OAuth2AppClientId的更多信息?

quickbooks-online
2个回答
0
投票
A

Google搜索可能是从这里开始的地方。以下是有关Client IDClient Secret是什么的大量资源:

  • 我引用:

      The client_id is a public identifier for apps.
  • The client_secret is a secret known only to the application and the authorization server.
  • Intuit也有

    ton

  • 个有关OAuth2的文档以及如何实现它。您应该阅读它:
  • 总而言之,Client ID是Intuit标识其

    您的应用

  • 试图连接到QuickBooks的方式。在构建/编译应用程序时,没有任何事情发生在字符串上-这只是正常现象string。但是,当您的应用程序通过QuickBooks Online进行身份验证时,您的应用程序会将Client ID发送到QuickBooks,以便QuickBooks知道它是您的应用程序试图授权与QuickBooks的连接,而不是其他应用程序的授权。

    0
    投票
    如果您想查看如何编写代码来加载它,那只是应用程序内部正在使用的一个属性

    OAuth2PlatformClientFactory

    @Service @PropertySource(value="classpath:/application.properties", ignoreResourceNotFound=true) public class OAuth2PlatformClientFactory { @Autowired org.springframework.core.env.Environment env; OAuth2PlatformClient client; OAuth2Config oauth2Config; @PostConstruct public void init() { // intitialize a single thread executor, this will ensure only one thread processes the queue oauth2Config = new OAuth2Config.OAuth2ConfigBuilder(env.getProperty("OAuth2AppClientId"), env.getProperty("OAuth2AppClientSecret")) //set client id, secret .callDiscoveryAPI(Environment.SANDBOX) // call discovery API to populate urls .buildConfig(); client = new OAuth2PlatformClient(oauth2Config); } public OAuth2PlatformClient getOAuth2PlatformClient() { return client; } public OAuth2Config getOAuth2Config() { return oauth2Config; } public String getPropertyValue(String propertyName) { return env.getProperty(propertyName); } }
    https://github.com/IntuitDeveloper/OAuth2-JavaWithSDK/blob/master/src/main/java/com/intuit/developer/sampleapp/oauth2/client/OAuth2PlatformClientFactory.java
    © www.soinside.com 2019 - 2024. All rights reserved.