My Products
Help
omelhus
PARTNER

Getting availableCompanies with Client Credentials

by omelhus

Hey,

 

How are we suppose to see what companies are accessible when we use client credentials?

 

According to the docs availableCompanies aren't supposed to work with client credentials, but then the only way to see what companies are available is to authenticate using a user context to check what companies the client credentials have access to.

 

https://docs.business.visma.net/docs/schema/queries/companies

18 REPLIES 18

by Marius Bancila

That is correct. Fetching available customers and companies do not work when using an access token with client credentials grant type.

 

This is something we are working on.

omelhus
PARTNER

by omelhus

Hey,

 

Do you have a timeline for this?

Accepted solution
Arnstein By
VISMA

by Arnstein By

Hi @omelhus, the goal is to have this in production in week 30.

omelhus
PARTNER

by omelhus

Is this in prod now?

by Marius Bancila

No, it is not, but I expect it to be at the end of next week (as we currently have weekly releases).

omelhus
PARTNER

by omelhus

Hey! Will this be released this Thursday?

Arnstein By
VISMA

by Arnstein By

Hi, this should be released to production now.

omelhus
PARTNER

by omelhus

Cool, but I'm getting a new error now.

 

{
  "errors": [
    {
      "message": "Could not fetch the list of available companies. Customer number is mandatory."
    }
  ],
  "data": {
    "availableCompanies": null
  },
  "extensions": {
    "vbnxt-trace-id": "000000000000000083b98bacc6b8f94b"
  }
}

by Marius Bancila

You need to provide a customer number. There is no other way we can provide this functionality otherwise, for the time being.

 

Here is the documentation for this feature: https://docs.business.visma.net/docs/schema/queries/companies#service-context 

omelhus
PARTNER

by omelhus

Ok, this was what I meant when I asked if it would "be the same method with the same signature and response", which this clearly isn't. As far as I can see this new functionality serves no purpose over what we had available before.

 

Any plans for implementing availableCustomers for services?

Accepted solution
Marius Bancila
VISMA

by Marius Bancila

`availableCustomers` now works for client credentials tokens too. There are several other changes mentioned here: https://docs.business.visma.net/docs/releasenotes#20230105 

omelhus
PARTNER

by omelhus

Thank you, thank you, thank you, thank you!!

omelhus
PARTNER

by omelhus

Ok, I managed to find the correct customer number using availableCustomers in a user context, but this is not available in the service context.

 

I don't really understand what problem this is suppose to solve? I need to see what companies my service has access to (without brute-force), and this is still not possible.

by Marius Bancila

Unfortunately, we are not able to provide a better solution and this is because of reasons that are beyond our team. I am not saying a solution in the future is not possible but it requires new infrastructure/services that will take a while to develop.

 

The workaround for now is that you use a user context login to fetch the available customers and then store their IDs somewhere and use it to query for available companies.

 

What kind of solution do you develop where the list of available customers changes often?

omelhus
PARTNER

by omelhus

Ok, I'll just have to add an additional setup layer then.

 

I'm working on a bank-integration (like Autopay). It would be cool to just be able to give the client access, and off it goes.

omelhus
PARTNER

by omelhus

Just to verify. It will be the same method with the same signature and response that will be used here? Just so I know that I can mock this for a couple of weeks.

by Marius Bancila

Yes, of course. There will be no changes in the schema for this.

omelhus
PARTNER

by omelhus

Perfect!