'why am I getting "invalid redirect_url" error message in OAuth 2.0 Authentication?

When I am working to get access token from a companies api I am getting "invalid redirect_url" error message. I set this redirect_url in companies api. I also tested this url and method with swagger. Url is working true.

My access_token request like this:

string serviceUrl = $"https://apis.blabla.com/auth/oauth/v2/token?client_id={apiKey}&client_secret={apiSecret}&grant_type=client_credentials&redirect_uri={redirectUri}";

My redirect url is public and like this:

string redirectUri = "http://asd.zxc.com:1234/Api/GenerateToken/GenerateAccessToken"

GenerateToken is controller and GenerateAccessToken is method name. Method type is Post(as documantation wanted). Request model is same in documantation. What could be the problem?

-Edit

Can GenerateAccessToken method be Void? Do I have to return something from redirect_url?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source