Hello Experts
Is there a basic working .Net sample on how to let a client authorize our app so we can get the access token and move forward from there?
We are able to get the token via password auth.
https://developers.ringcentral.com/guide/authentication/jwt-flow does not have sample payload necessary.
Your help is much appreciated.
This is a public function in the .NET SDK
public Task<TokenInfo> Authorize(string jwt) { var getTokenRequest = new GetTokenRequest { grant_type = "urn:ietf:params:oauth:grant-type:jwt-bearer", assertion = jwt }; return Authorize(getTokenRequest); }
So you can authenticate your app like this
... static RestClient restClient; static void Main(string[] args) { restClient = new RestClient( "RC_CLIENT_ID, "RC_CLIENT_SECRET", "RC_SERVER_URL"); restClient.Authorize("JWT_TOKEN").Wait(); ... }
Hey Phong
Thank you for your response.
The way I understand is that I would have page (aspx) that would have a button which will pass parameters to RC and RC will redirect back with the approval payload (json).
My experience with JWT authentication is very limited, so may be this might be a silly question. But what is the order of calls to be made? Also, which RingCentral library to use (there are two or three that I see on nuget).
Again, my apologies if these are too obvious of a question to be asking here.
JWT tokens can be used to replace the password flow which requires a username and password. It is used for Server-only (No UI) application.
What you wrote made me doubt that you want a user to login the app from a Web page. If that is the case, you have to create a Browser app (instead of Server-only) and choose the 3-legged authorization flow. See this quick start to begin. It also shows you what nugget packages you need to add to your project.
I did review that tutorial earlier.
But that code does not even compile.
This is kind of where I am wondering what I am doing wrong and posted the question here.
Hi @Smit Shah
I have attached an example of OAuth using the SDK as part of the email chain we have had.
I am adding it here again for your reference https://github.com/nerdchacha/dotnet-oauth-demo
Thanks Tyler and Yatin, that extension piece is what I was missing.
Made some good progress based on your feedback, thank you.
So as a follow up question, where can I find info on
1) If the token I get is going to let me pull call logs for "all users" if super admin authorizes, or if I will have to authorize each user in the client's account?
2) Is there a tutorial on how to track token expiration and handle token refresh?
Please let me know if you'd prefer I open a new topic for these questions.
Thank you both again so much for your help.
@Smit Shah
1. You can use the readCompanyCallLog endpoint to read call logs of the entire account
https://developers.ringcentral.com/api-reference/Call-Log/readCompanyCallLog
You need to make sure your application has the "ReadCallLog" permission and the user you are using to log in to the app to get the access token has the "ReadAccountCallLog" permission.
Your super admin should have the "ReadAccountCallLog" permission
These details can be found here for every API endpoint
So, when I look at https://developers.ringcentral.com/guide/authentication/refresh-tokens I am not sure how/which value for refresh_token do I use.
I am now able to successfully use OAuth and get the first set of tokens, no problem.
Nevermind, found it under platform.refresh
The authorizeUri method has been moved to an extension since RingCentral.Net 5.0: https://github.com/ringcentral/RingCentral.Net/tree/master/RingCentral.Net.AuthorizeUri
Then guide hasn't been updated.
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