Last active
December 18, 2017 19:29
-
-
Save kuangzhang/1f188e3f854cc6591b14e833a4adbb87 to your computer and use it in GitHub Desktop.
Reddit API URL Authentication Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| public class Program | |
| { | |
| public static void Main() | |
| { | |
| string _clientId = "ghXCFiKzs_SxWX"; //ID under you reddit app name, you get after reddit app creation | |
| string _state = new Guid().ToString(); //Unique ID | |
| string _redirectUri = "http://localhost:8080"; //Filed in when applying for Reddit App | |
| string _user_agent = "- with my web scrapper"; //some dummie description of your app | |
| string _scope = "*"; | |
| bool permanent = true; | |
| Console.WriteLine | |
| ( | |
| String.Format( | |
| "https://ssl.reddit.com/api/v1/authorize?client_id={0}&response_type=code&" + _ | |
| "state={1}&redirect_uri={2}&duration={3}&scope={4}&user_agent={5}", | |
| _clientId, _state, _redirectUri, | |
| permanent ? "permanent" : "temporary", _scope, _user_agent) | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment