Skip to content

Instantly share code, notes, and snippets.

@JoubaMety
Last active December 25, 2024 00:02
Show Gist options
  • Save JoubaMety/cd0e1d46a5d8c80168db1f150fb08f69 to your computer and use it in GitHub Desktop.
Save JoubaMety/cd0e1d46a5d8c80168db1f150fb08f69 to your computer and use it in GitHub Desktop.
Early Discord Bluesky Connection

⚠️ !!!NO LONGER NEEDED!!! ⚠️

You can add Bluesky Connection via Desktop/Browser client now, eliminating the need for this script. image

for archival reasons (lol)

Script Screenshot

Prerequisites

Instructions

  1. Run the following snippet in Powershell(!) to run the script and follow the instructions:
irm https://gist.githubusercontent.com/JoubaMety/cd0e1d46a5d8c80168db1f150fb08f69/raw/a0aae9e85e00075e989a369a25f6a1ed93e7d088/discord-bluesky-authorize.ps1 | iex

If the script ran successfully, you should've gotten a link that starts with https://bsky.social/oauth/authorize.

  1. Open the link and follow the instructions.

  2. ???

  3. Profit!

Bluesky Connection on Discord

Caveats

  • While the Bluesky Connection will display on official Desktop/Browser client, it might not display on official Android/iOS client.

Desktop/Browser client vs Android client difference

$discordApiUri = "https://discord.com/api/v9/connections/bluesky/authorize"
$helpDiscordToken = "https://gist.github.com/MarvNC/e601f3603df22f36ebd3102c501116c6"
# Convert from Secure String to Plain Text (for Powershell below v7.0)
# Source: https://gist.github.com/JeremyTBradshaw/10c67244cf380a66b6ca0e59139cd11d
function ConvertFrom-SecureStringToPlainText ([System.Security.SecureString]$SecureString) {
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto(
[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString)
)
}
New-Alias -Name s2p -Value ConvertFrom-SecureStringToPlainText
Write-Host "Help: Discord Token Get Tutorial: $helpDiscordToken" -f Yellow
$_token = s2p(Read-Host "Please enter your Discord token" -AsSecureString)
$request = try {
Invoke-WebRequest -Uri $discordApiUri -Headers @{"authorization"=$_token}
} catch {
$_obj = $_ | ConvertFrom-Json
Write-Host "$($_obj.message)" -f Red
if ($_obj.code -eq 0) { Write-Host "Possible reason for error: Invalid token" -f Yellow }
}
$reqContent = $request.Content | ConvertFrom-Json
$url = $reqContent.url
if ($url.StartsWith("https://bsky.social/oauth/authorize")) {
Write-Host "Successfully got link: " -f Green -NoNewline
Write-Host $url -f Blue
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment