Skip to main content

When i try to get access token getting this issue.


I'm using below code:


RestClient rc = null;

if (!string.IsNullOrWhiteSpace(Config.Instance.server))

{


rc = new RestClient(Config.Instance.appKey, Config.Instance.appSecret, Config.Instance.server);

}

else

{


rc = new RestClient(Config.Instance.appKey, Config.Instance.appSecret, Config.Instance.production.Value);

}

await rc.Authorize(Config.Instance.username, Config.Instance.extension, Config.Instance.password);


Assert.NotNull(rc.token.access_token);

I think the Assert library doesn't support async await code although I am don't know which unit testing library you are using. Please change to  var token = rc.Authorize(Config.Instance.username, Config.Instance.extension, Config.Instance.password).Result;   and try again.
Thank for your response, i am also use this way, but not get the token throw the 400 Bad Request error, i pasted my code changes 

public RestClientFixture()
        {
            if (!string.IsNullOrWhiteSpace(Config.Instance.server))
            {
                rc = new RestClient(Config.Instance.appKey, Config.Instance.appSecret, false);
            }
            else
            {
                rc = new RestClient(Config.Instance.appKey, Config.Instance.appSecret, false);
            }

            var temp = rc.Authorize(Config.Instance.username, Config.Instance.extension, Config.Instance.password).Result;
        }

i refer this link to implement this concept , https://github.com/grokify/ringcentral-demos-oauth/tree/master/csharp-nancy/

but still i am not getting, 

Authorize method return below error, 
{"Request to https://platform.devtest.ringcentral.com/restapi/oauth/token failed with status code 400 (Bad Request)."}

even i download multiple source code to implement this concept using c# but all are return same issue. i don't know where i missing. Please give idea to resolve this issue.

Here i pasted the screenshot for the response error.



hello if any idea about this issue Please let me know



Reply