Example #1
0
        public string AuthorizeUrl(string redirectUri, AccessScope scopes)
        {
            var parameters = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>("scope", scopes.ToString().ToLower().Replace(",", "")),
                new KeyValuePair <string, object>("response_type", "code"),
                new KeyValuePair <string, object>("redirect_uri", redirectUri),
                new KeyValuePair <string, object>("client_id", Client.ClientId)
            };

            return($"https://{Client.Domain}/oauth/authorize?{string.Join("&", AppClient.AsUrlParameter(parameters))}");
        }
Example #2
0
        public async Task <Application> RegisterAsync(string clientName, string redirectUris, AccessScope scopes, string website = null)
        {
            var parameters = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>("client_name", clientName),
                new KeyValuePair <string, object>("redirect_uris", redirectUris),
                new KeyValuePair <string, object>("scopes", scopes.ToString().ToLower().Replace(",", ""))
            };

            parameters.AddIfValidValue("website", website);

            var response = await PostAsync <Application>(parameters : parameters).Stay();

            Client.ClientId     = response.ClientId;
            Client.ClientSecret = response.ClientSecret;

            return(response);
        }