{"id":20765801,"url":"https://github.com/rkrehn/getreddittoken","last_synced_at":"2026-04-25T22:31:44.573Z","repository":{"id":195817538,"uuid":"693732080","full_name":"rkrehn/GetRedditToken","owner":"rkrehn","description":"For Reddit developers - how to retrieve your access token ","archived":false,"fork":false,"pushed_at":"2023-09-19T16:03:06.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T12:49:21.884Z","etag":null,"topics":["access","accesstoken","curl","powershell","powershell-script","reddit","reddit-api","reddit-client","token"],"latest_commit_sha":null,"homepage":"https://www.krehnsolutions.com","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rkrehn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-19T15:45:39.000Z","updated_at":"2023-09-19T16:04:16.000Z","dependencies_parsed_at":"2023-09-19T18:54:08.878Z","dependency_job_id":null,"html_url":"https://github.com/rkrehn/GetRedditToken","commit_stats":null,"previous_names":["rkrehn/getreddittoken"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rkrehn/GetRedditToken","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkrehn%2FGetRedditToken","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkrehn%2FGetRedditToken/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkrehn%2FGetRedditToken/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkrehn%2FGetRedditToken/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rkrehn","download_url":"https://codeload.github.com/rkrehn/GetRedditToken/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkrehn%2FGetRedditToken/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32279652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access","accesstoken","curl","powershell","powershell-script","reddit","reddit-api","reddit-client","token"],"created_at":"2024-11-17T11:19:02.724Z","updated_at":"2026-04-25T22:31:44.544Z","avatar_url":"https://github.com/rkrehn.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# GetRedditToken\nThis tutorial is intended for Reddit developers who need to retrieve their API access token. I spent a significant amount of time trying to figure out how to do this, and the recommended guide did not help, as I kept getting various errors. I hope this tutorial will be more helpful to others.\n\nAn API access token is required to access the Reddit API. To retrieve your access token, you can use the following PowerShell script.\n\n# Setup\n\nYour first step will need to be creating a Reddit app\n\n1. Go to [https://www.reddit.com/prefs/apps](https://www.reddit.com/prefs/apps) once you've logged into Reddit.\n2. Click \"Create App\"\n3. Enter name, select \"script\", and enter everything. None of the following fields really matter since they won't be used.\n![image](https://github.com/rkrehn/GetRedditToken/assets/15220483/158d363c-7892-47e3-a0da-b372b3457c5b)\n4. Click \"Create App\"\n\n# PowerShell\n\nOnce you have an App ID and a secret key, you will need to save the following into a text document:\n\n```PowerShell\n$Headers = @{\n    'User-Agent'  = 'User agent'\n    'Authorization' = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes('[App Id]:[Secret Key]'))\n}\n\n$Body = @{\n    'grant_type' = 'password'\n    'username'   = '[username]'\n    'password'   = '[password]'\n}\n\n$response = Invoke-WebRequest -Uri 'https://www.reddit.com/api/v1/access_token' -Method POST -Headers $Headers -Body $Body\n\n# Display the response content\n$responseContent = $response.Content\nWrite-Host \"Response Content:\"\nWrite-Host $responseContent\n```\n\nIn the above, replace anything in the brackets [] with the correct information. For example, where it says **[App Id]**, then replace it your App ID from the above steps. Mine looks something like the following, except I scrambled some of the letters for security reasons:\n\n```PowerShell\n$Headers = @{\n    'User-Agent'  = 'User agent'\n    'Authorization' = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes('pasFsdLQ3swX3dsfdzx35w:aeEGAROQdwqPftDD5UBCf_3rDGTnbs'))\n}\n\n$Body = @{\n    'grant_type' = 'password'\n    'username'   = 'lordkrehn'\n    'password'   = 'l0ln1c3try'\n}\n\n$response = Invoke-WebRequest -Uri 'https://www.reddit.com/api/v1/access_token' -Method POST -Headers $Headers -Body $Body\n\n# Display the response content\n$responseContent = $response.Content\nWrite-Host \"Response Content:\"\nWrite-Host $responseContent\n```\n\nSave this text file as a PowerShell script (*.ps1) somewhere you can easily access it. I saved it on my desktop as \"new.ps1\". \n\n# Running the PowerShell\n\nNow that you've created the script, you'll need to run it.\n\n1. Open PowerShell as an Administrator\n2. Type the following and hit enter\n```\nSet -ExecutionPolicy RemoteSigned\n```\n3. Type \"Y\" and hit enter\n4. Navigate to your directory using the CD command. Mine was saved on the desktop\n```\nCD C:\\Users\\Me\\Desktop\n```\n5. Now, execute the script\n```\n\\new.ps1\n```\n6. If you set up everything correctly, you'll receive a response with your access token. It will be the long block of text following **access_token**:\n\n![image](https://github.com/rkrehn/GetRedditToken/assets/15220483/253001d6-54e1-4e75-ad94-13bacb90acbd)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkrehn%2Fgetreddittoken","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frkrehn%2Fgetreddittoken","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkrehn%2Fgetreddittoken/lists"}