Skip to main content
Solved

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

  • December 2, 2021
  • 1 reply
  • 308 views

  • Participating Frequently
  • 6 replies

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

Best answer by Tyler850957020

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.

View original
Did this thread help you find an answer to your question?

1 reply

  • Community Manager
  • 420 replies
  • Answer
  • December 2, 2021

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings