Skip to content

Commit

Permalink
nordvpn
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesTurland committed Dec 19, 2024
1 parent 0ebdc1d commit cc58e22
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions NordVPN-Wireguard/wireguard.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Gain your token by heading to your NordVPN account and going to "Get Access Token"
# URL: https://my.nordaccount.com/dashboard/nordvpn/access-tokens/authorize/
$username = "token"
$password = "my-token-from-nordvpn"
$auth = "$($username):$($Password)"
$bytes = [System.Text.Encoding]::ASCII.GetBytes($auth)
$encodedCredentials = [Convert]::ToBase64String($bytes)
$url = "https://api.nordvpn.com/v1/users/services/credentials"

$headers = @{
Authorization = "Basic $encodedCredentials"
}

# Prints out Username, Password, and Nordlynx Private Key (this is what you need for Wireguard)
Invoke-RestMethod -Uri $url -Headers $headers -Method Get

# ****IGNORE - MIGHT BE OF USE FOR SCRIPTING*******
# Send the GET request and capture the result
# $response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get

# Output specific properties
# $response | Select-Object id, created_at, updated_at, username, password, nordlynx_private_key

# Optionally, you can access individual properties like this:
# Write-Output "ID: $($response.id)"
# Write-Output "Username: $($response.username)"
# Write-Output "Password: $($response.password)"
# Write-Output "NordLynx Private Key: $($response.nordlynx_private_key)"

0 comments on commit cc58e22

Please sign in to comment.