예제 #1
0
        /// <summary>
        /// Gets the implicit OAuth flow endpoint that allows a user to approve or reject an application.
        /// </summary>
        /// <param name="scope">The scope of the token requested by the application.</param>
        /// <param name="state">The optional state object.</param>
        /// <returns>The API endpoint with the requested parameters.</returns>
        public string GetImplicitOAuthApprovalUri(IOAuthScope scope = null, IOAuthState state = null)
        {
            string uri   = OAuth.ImplicitUri;
            string query = GetOAuthApprovalParameters(scope, state);

            return(string.Concat(uri, query));
        }
예제 #2
0
        /// <summary>
        /// Gets the query string parameters to an OAuth flow endpoint for it's first step in the authentication process.
        /// </summary>
        /// <param name="scope">The scope of the token requested by the application.</param>
        /// <param name="state">The optional state object.</param>
        /// <returns>The requested query string parameters, serialized.</returns>
        private string GetOAuthApprovalParameters(IOAuthScope scope = null, IOAuthState state = null)
        {
            IList <QueryParam> parameters = new List <QueryParam>();

            parameters.Add(new QueryParam(OAuth.AppIdParameter, AppId));
            parameters.Add(new QueryParam(OAuth.RedirectUriParameter, RedirectUri));
            parameters.Add(new QueryParam(OAuth.StateParameter, state));
            parameters.Add(new QueryParam(OAuth.ScopeParameter, scope));

            return(parameters.DeserializeAsQueryString());
        }