Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurred refreshing the Xero access token. Reason: Parameter is required Parameter name: refresh_token #487

Open
marcelmgm opened this issue Oct 3, 2023 · 3 comments

Comments

@marcelmgm
Copy link

SDK 2.2.9

Hi,
For unknow reason im starting to get this error now:
"An error occurred refreshing the Xero access token. Reason: Parameter is required Parameter name: refresh_token"

Anyone else?

Code im using:

public XeroToken GetToken()
{
  ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

  var xeroOAuth2Token = this.TokenStore.GetToken();

		if (DateTime.UtcNow > xeroOAuth2Token.ExpiresAtUtc)
		{
			var client = new XeroClient(new XeroConfiguration
    {
      AppName = Settings.AppName,
      ClientId = Settings.ClientId,
      ClientSecret = Settings.ClientSecret,
      Scope = Settings.Scopes
    });

    try
    {
			  xeroOAuth2Token = (XeroOAuth2Token)client.RefreshAccessTokenAsync(xeroOAuth2Token).Result;
    }
    catch (Exception ex)
			{
      throw new Exception($"An error occurred refreshing the Xero access token. Reason: {(ex.InnerException == null ? ex.Message : ex.InnerException.Message)}");
			}

    this.TokenStore.StoreToken(xeroOAuth2Token);
		}

  return new XeroToken
  {
    AccessToken = xeroOAuth2Token.AccessToken,
    TenantId = Convert.ToString(xeroOAuth2Token.Tenants[0].TenantId)
  };
}
@github-actions
Copy link

github-actions bot commented Oct 3, 2023

PETOSS-353

@github-actions
Copy link

github-actions bot commented Oct 3, 2023

Thanks for raising an issue, a ticket has been created to track your request

@marcelmgm
Copy link
Author

I fixed by refreshing token manually using xoauth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant