I swear I set it up right, but it's failing, and I can't figure out where to look. Using C# and latest SDK.
Using Fiddler, I see that the call to https://platform.devtest.ringcentral.com/restapi/oauth/token, with this info:
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJraWQiOiI4NzYyZjU5OGQwNTk0NGRiODZiZjVjYTk3ODA0NzYwOCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0..... (not putting the whole token here, but it's in the parms).
Says it's using TLS1.2, so that's right. Returns:
{ "error" : "unauthorized_client", "errors" : [ { "errorCode" : "OAU-251", "message" : "Unauthorized for this grant type" } ], "error_description" : "Unauthorized for this grant type" }
App is set up to use JWT (I also tried setting to password auth with the right user/ext/password and that returned the same outcome). The JWT token is correct. What did I do wrong? Once the 400 happens, authorize call hangs.
Thanks in advance.
Before investigating your case, can you give me the app client id so I can have a look at the app settings.
1A_7xhOcR1OKhkuFetzZfQ
thank you!
Can you try it now. I changed the app scope from public to private as the JWT was personal and the platform type is server-only. Let me know if your app must be a public app.
Halfway there maybe.
Getting a 200 response with a token, so that part looks right (see below). But, the .Authorize call
rc.Authorize(ConfigurationManager.AppSettings["RC Token"]).Wait();
isn't coming back from the Wait() still. What else is it waiting on?
The plan is that this customer is the only one to ever run it, so private is perfect.
In case you need it, Fiddler shows the response came back with something like this:
{ "access_token" : "U0pDMTJQMDFQQVMw....", "token_type" : "bearer", "expires_in" : 3600, "refresh_token" : "U0pDMTJQMDFQQVMw....", "refresh_token_expires_in" : 604800, "scope" : "Faxes", "owner_id" : "714822005", "endpoint_id" : "y-janHULTiaQuTUOmX6gbg" }
if it's not returned, how do you get the tokens then? Pls share some code (w/o sensitive info)
Using Fiddler to see the requests and responses.
Code is inside an asynchronous routine, and looks like this, and I'm seeing the packets for the .Authorize() call, but the .Wait just sits and never returns.
var rc = new RestClient(ConfigurationManager.AppSettings["RC Client"], ConfigurationManager.AppSettings["RC Secret"], ConfigurationManager.AppSettings["RC URL"]); rc.Authorize(ConfigurationManager.AppSettings["RC Token"]).Wait();
It's prone to cause dead lock if you mix .Wait()/.Result and await. But this is a pure C# programming issue, not related to RingCentral.
And I believe if you try to authorize via password instead of JWT, you app will be stuck too.
You are correct, it was a deadlock, inside a Winforms UI event, putting Task.Run(async() => around it solved the problem, thank you!
Sorry, SYNCHRONOUS routine. Not async.
I believe it's a C# deadlock. https://stackoverflow.com/questions/15021304/an-async-await-example-that-causes-a-deadlock
I would avoid using .Wait() and stick to await.
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder