Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

Xero.APi.SDK.Minimal - set UserAgent for GetRequestTokenAuthorizeUrl & RetrieveAndStoreAccess

Started by Kudos Development -   in Wrapper libraries

hi everyone,

i'm using the Xero.APi.SDK.Minimal wrapper

im using IMvcAuthenticator which consists of the following 2 methods i require for the authentication process.

when calling GetRequestTokenAuthorizeUrl(userID) and

I see the request as
User-Agent: Xero Api wrapper - xxxxxxxxxxxxx

I'm wanting to change the User-Agent to be my application name,

anyone know how this can be done?

Hi There,

In the Xero.Api.Example.Counts example project, UserAgent parameter can be set like below.

var api = new Applications.Public.Core(tokenStore, user)
UserAgent = "Your application name - XXXXXXXX"

This will override the default format.

Jenks Guo (Xero Staff)  

hi Jenks,

the code you provided only sets the UserAgent after you have successfully authenticated

I'm wanting to set the UserAgent when calling GetRequestTokenAuthorizeUrl and RetrieveAndStoreAccessToken (before we have token) from the IMvcAuthenticator

but looking at the source code of the wrapper api, the user agent appears to be hard coded, see here

we are currently going through the partner process and 1 of the things that were raise is that we must set the UserAgent

i've raised a case here, unsure when it will be picked up,

unless they allow us to set the UserAgent when we use the xero wrapper we can't get partner status

Kudos Development  

Hi Kudos Dev,

For app partner certification, we don't actually require the authentication itself to have the UserAgent set. As long as the api call's http header has required UserAgent is fine.

Jenks Guo (Xero Staff)