MVVM-Samples icon indicating copy to clipboard operation
MVVM-Samples copied to clipboard

RedditService service fails with 403 Blocked error

Open gragra33 opened this issue 1 year ago • 0 comments

There is an easy fix for this, we need to add a 'User-Agent' header, something like below:

public interface IRedditService
{
    /// <summary>
    /// Get a list of posts from a given subreddit
    /// </summary>
    /// <param name="subreddit">The subreddit name.</param>
    [Headers("User-Agent: Awesome CommunityToolkit.Mvvm Sample App")]
    [Get("/r/{subreddit}/.json")]
    Task<PostsQueryResponse> GetSubredditPostsAsync(string subreddit);
}

Now the sample in the 'The Final Result!' will work correctly.

gragra33 avatar May 19 '23 01:05 gragra33