RingCentral.Platform.AuthorizeUri C# (CSharp) Method

AuthorizeUri() public method

When your application needs to authentiate an user, redirect the user to RingCentral API server for authentication. This method helps you to build the URI. Later you can redirect user to this URI.
public AuthorizeUri ( string redirectUri, string state = "" ) : string
redirectUri string This is a callback URI which determines where the response will be sent to. The value of this parameter must exactly match one of the URIs you have provided for your app upon registration. This URI can be HTTP/HTTPS address for web applications or custom scheme URI for mobile or desktop applications.
state string Optional, recommended. An opaque value used by the client to maintain state between the request and callback. The authorization server includes this value when redirecting the user-agent back to the client. The parameter should be used for preventing cross-site request forgery
return string
        public string AuthorizeUri(string redirectUri, string state = "")
        {
            var baseUrl = ServerUrl + "/restapi/oauth/authorize";
            var authUrl = string.Format("{0}?response_type=code&state={1}&redirect_uri={2}&client_id={3}",
                baseUrl, Uri.EscapeDataString(state),
                Uri.EscapeDataString(redirectUri),
                Uri.EscapeDataString(appKey));
            return authUrl;
        }