0

要在 Xero 中生成访问令牌,我正在关注链接 Xero-NetStandard

namespace AsyncMain{
class Program
{
    static async Task Main(string[] args)
    {
        var helloWorld = await GetHelloWorldAsync();
        Console.WriteLine(helloWorld);
    }

    static async Task<string> GetHelloWorldAsync()
    {   
        XeroConfiguration XeroConfig = new XeroConfiguration
        {
            ClientId = System.Environment.GetEnvironmentVariable("CLIENT_ID"),
            ClientSecret = System.Environment.GetEnvironmentVariable("CLIENT_SECRET")
        };

        var client = new XeroClient(XeroConfig);
        var xeroToken = await client.RequestClientCredentialsTokenAsync();

       return xeroToken.AccessToken;
    }
}}

上面的代码总是抛出“unauthorized_client”异常,即使传递了正确的客户端 ID 和客户端密码。

请帮助解决这个问题。

提前致谢

4

0 回答 0