question

Benny Dadon avatar image
Benny Dadon asked Tyler Liu answered

How call 3 legged Authorization request From APP Controller (Asp.net core) and get access token in same controller

I have already implemented 3 legged authorization using c# in a startup.cs class which is working fine. Now I want I can send a login request when any user hits the APP controller then the request needs to be generated and the access token will return in the same controller after this I can show a view to the user where he can type Number and SMS then click on the send button.

So if anyone has a solution kindly help me or guide me on how I can do this.
Thanks

ringcentral app
1 |1500

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

1 Answer

Tyler Liu avatar image
Tyler Liu answered

Please read this https://medium.com/ringcentral-developers/a-minimal-project-to-implement-ringcentral-auth-code-flow-in-javascript-bf995d458424

It's not C# but it's minimal. It's good for you to understand the whole flow. It's a single JS page, just like you want to do it in a single controller.


So in the controller code, you need to check wether there is query parameter named "code".

If yes, you exchange the code for access token and do whatever you want (send sms).

If no, you need to redirect user to the login URI, which can be generated using https://github.com/ringcentral/RingCentral.Net/tree/master/RingCentral.Net.AuthorizeUri

Be sure to set the redirect URI to the controller page, so that after user logged in, he will redirected back to you controller with "code" in query parameter.

1 |1500

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

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys