MVVM-Samples
MVVM-Samples copied to clipboard
RedditService service fails with 403 Blocked error
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.