to get a personalized navigation.
to get a personalized navigation.
Jeg bruker den koden jeg har brukt lenge, og som har funket.
_restRequest = new RestRequest("API/security/api/v2/token", Method.POST);
_restRequest.AddHeader("Content-Type", "application/x-www-form-urlencoded");
_restRequest.AddHeader("Accept", "application/json");
_restRequest.AddHeader("ipp-application-type", _ippApplicationType);
_restRequest.AddHeader("ipp-company-id", _ippCompanyId);
_restRequest.AddParameter("grant_type", "password");
_restRequest.AddParameter("client_id", _client_id);
_restRequest.AddParameter("client_secret", _client_secret);
_restRequest.AddParameter("username", _username);
_restRequest.AddParameter("password", _password);
IRestResponse response = new RestClient(_url).Execute(_restRequest);
_statusCode = response.StatusCode.ToString();
if (_statusCode == "OK")
{
string content = response.Content;
VismaSecurityToken myToken = JsonConvert.DeserializeObject<VismaSecurityToken>(content);
_token = "Bearer " + myToken.token;
}
response.StatusCode.ToString(); gir "0". Betyr det at brukeren min ikke har rette rettigheter?
Solved! Go to Solution.
As seen in the code, I use the endpoint API/security/api/v2/token. And the Method POST.
I can not find this endpoint in swagger
I thought the problem was related to what rights the user has,
but I have now tried with parameters I use for another customer.
I'm getting the same problem.
This is code I have used for several to without any problems.
If you can send your API-Client-ID to developersupport@visma.com we can check with the VNI team if there are any issues with your client.
Thank you.
developersuppor@visma.com is not accepted as an email address.
API-Client-ID: proplan
Hi,
Sorry missed a "t", we'll check and get back to you.
The problem was solved by VNI-Support Ticket 1823568T
Hi!
I have to apologize. I used the wrong URL.
I used //integration.visma.net/API/security/api/v2/token.
I now use https://integration.visma.net/API/security/api/v2/token
I was not concentrating on that. I was sure there were no changes here.
Thanks for your help
Regards
Dag Grønvold
Hi,
Please be aware that this forum is international and with regards to this the communication is done in English.
Unfortunately, our support does not cover code support as specified in our terms, more information regarding practises in this forum can be found here:
Regarding the response, a status code of '0' should never be returned. It should return a proper HTTP status code.
Please also have a look at this article:
Could you please try to authenticate in Swagger and/or Postman and share your results?
Copyright © 2022 Visma.com. All rights reserved.