-
Notifications
You must be signed in to change notification settings - Fork 53
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
When have multi clients, The API client's Oauth2Token keeps the same #99
Comments
Hmmm. Could you detail your use case? What's the reasoning for swapping between ClientID and ClientSecret credentials? |
@RettBehrens We set up each app for each billing entity because some business logic there has different scopes and we need to separate them. And run some corn job base on them. for now I have to assign the OauthToken again to avoid this issues
I am not sure if other languages' SDK also have this behavior. |
@RettBehrens Test from nodejs sdk. it works as excepted. differences API clients have different config. here's the test code
output:
|
Hi @ezioruan what you're describing is against Xero Developer Platform Ts&Cs. Specifically section 7b Be a Good Citizen to our Ecosystem: You share Xero and our Developer Platform with your fellow developers and you should write Your Application as you’d want others to write theirs. You agree not to use, nor permit any third party to use, the Developer Platform to:
Suggested resolution - use one set of ClientID and ClientSecret credentials, adjusting what scopes are requested during auth/consent |
@RettBehrens Thanks for your reply, so it's the right behavior. but why node js client can have a differences client_id for each api_client? |
@ezioruan Looking at the source file from openapi-generator, I can see there is no In the Xero-Node SDK, while most of the files generated, I will need to investigate further and consult with the team to determine which is the correct / expected behavior. |
Looks good. Thanks for your reply. I don't know how to use the generate tools. Could you take a look to see if the newly generated files are correct (without TypeWithDefault ) |
We are having the same issue. We are currently using two client objects, one is using a private connection auth, and the other is using code flow auth. When using both instances in the same process it fails because the client id/secret gets mixed up. |
An update on this topic. I believe I've found an issue identifying the same problem with OpenAPITools openapi-generator. Following the thread, it seems TypeWithDefault was added at some time and ultimately removed - our fork of the generator must have occurred after it was added but before it was removed. Going to take some time but I'll create a ticket to refactor the configuration so it doesn't use TypeWithDefault. |
Looks like the bug was reported years ago but still have problems, hope we can solve this . If there's some document about how to generate those codes I think it would be a big help |
if we buy 2 custom connections for 2 organizations and use them in a python app, then we would end up here, the 2nd client_id can't be used |
This workaround seems to work for me: from xero_python.api_client import Configuration as BaseConfiguration
from xero_python.api_client.configuration import TypeWithDefault
class Workaround(TypeWithDefault):
def __call__(cls, *args, **kwargs):
return super(TypeWithDefault, cls).__call__(*args, **kwargs)
class Configuration(BaseConfiguration, metaclass=Workaround):
pass |
I have an app that connects to many client_ids, and I found their's client_id and client_secret keep the same even though I put different config,
here are some test codes:
And the output is :
You can see they are the same client_id and client_secrets
I am wondering if it's the correct behavior or is a bug,
I found the root cause here https://github.com/XeroAPI/xero-python/blob/master/xero_python/api_client/configuration.py#L41.
The Configuration's metadata makes him always copy attributes from the same instance.
What's the purpose of doing this?
The text was updated successfully, but these errors were encountered: