question

sprout-system26807 avatar image
sprout-system26807 asked ·

Id = 8, Status = WaitingForActivation, Method = "{null}", Result = "{Not yet computed}"

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);
aaa
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered ·
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.
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

sprout-system6828 avatar image
sprout-system6828 answered ·
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.
1 comment Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Could you please run your code in Visual Studio in debug mode and inspect the inner exceptions? 400 (Bad request) is not very useful for troubleshooting.

Even when the response status code is 400, you can still get the HTTP message body and read the error detail so we could know what happened.

It might because your credentials are wrong. But we are not sure until you see the HTTP response body which contains error message.
0 Likes 0 · ·
sprout-system6828 avatar image
sprout-system6828 answered ·
Here i pasted the screenshot for the response error.


Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

sprout-system26807 avatar image
sprout-system26807 answered ·
hello if any idea about this issue Please let me know


1 comment Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

We need to extract the response body. I forgot to post you more information:
https://github.com/tmenier/Flurl/issues/114
http://tmenier.github.io/Flurl/error-handling/
catch (FlurlHttpException ex) {     // For error responses that take a known shape     TError e = ex.GetResponseJson<TError>();      // For error responses that take an unknown shape     dynamic d = ex.GetResponseJson();     string s = ex.GetResponseString();&nbsp; }
0 Likes 0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.