Skip to content

Generating Secrets.json

Joe D edited this page Sep 5, 2018 · 1 revision

Generate your secrets.json

It is important to note that if you do not plan on working on any of the backend/reddit code and only plan on working on UI related stuff you only need to paste in the empty json template provided below into assets/secrets.json to get a build going. However, if you would like to see your design in action and populated with data I would recommend finishing the process. It's pretty easy and only needs to be completed once.

DitRa stores it's OAuth client secrets in a json file called secrets.json under the assets folder. This file is always excluded from git commits due to its sensitive nature.

These values can be generated by heading to this link and scrolling to the bottom. Find a link that says something like "I am a developer" or "enable developer mode" or something along those lines and click it.

Then:

  • Click Create another app...
  • Give it a name (can be anything)
  • Leave Web app selected
  • Give it a description
  • Set the about url to http://www.thenightmancodeth.me/ditra
  • Set the redirect url to https://www.ugottapaythetrolltoll.to/get_in
  • Click Create app

Now it's time to create the actual .json file.

  • With your editor of choice, create a new file and save it under the assets directory in the root of the repo as secrets.json
  • Copy the following into the file:

{
    "client_id": "",
    "client_secret": "",
    "redirect_uri": "",
    "user_agent": "",
    "oauth_url": ""
}

Your client_id is the value located directly under the header on your app. It's a 14 character secret string that identifies your app when you access the reddit API. The client_secret is located in the details of your app. You may have to click on edit to find it, but it is labeled secret and is a much longer string of random characters.

Once you have filled in those first two values, the redirect_uri is the same as the redirect url above. Yes, the trolltoll one. For user_agent you should make up something clever. Maybe yourusername:ditra_dev or something. Lastly, the oauth_url value needs to be generated. Luckily it's very easy to do. Here is what yours should look like:

https://www.reddit.com/api/v1/authorize?client_id=(paste your client_id here)&response_type=code&&redirect_uri=https://www.ugottapaythetrolltoll.to/get_in&state=(the name you gave your app on reddit)&duration=permanent&scope=%2A

Just replace the ()s with your client_id and app name and paste that link into the oauth_url field and you're done! Now to generate a keysign certificate.

Clone this wiki locally