Skip to content

Instantly share code, notes, and snippets.

@pjmagee
Last active December 22, 2022 05:31
Show Gist options
  • Select an option

  • Save pjmagee/689b320740724f7e0c5c79c6462a335b to your computer and use it in GitHub Desktop.

Select an option

Save pjmagee/689b320740724f7e0c5c79c6462a335b to your computer and use it in GitHub Desktop.
$pts = $true
# Path to SWTOR Install
$install = @{
path = $pts ? ("G:\Star Wars - The Old Republic\publictest\retailclient\swtor.exe") : "G:\Star Wars - The Old Republic\swtor\retailclient\swtor.exe"
workingDirectory = $pts ? ("G:\Star Wars - The Old Republic\publictest\retailclient") : "G:\Star Wars - The Old Republic\swtor\retailclient"
}
Get-Process *swtor* | Stop-Process
# ONE-TIME PASSWORD
# https://1password.com/
# https://developer.1password.com/docs/cli/
$secrets = ((op item get SWTOR --format json) | ConvertFrom-Json)
$username = $secrets.fields[0].value
$password = $secrets.fields[1].value
$otp = $secrets.fields[6].totp
$body = @{
email = "${username}"
methodList = @(
@{
value = "${password}"
method = "PASSWORD"
},
@{
value = "${otp}"
method = "SECURITY_KEY"
})
}
$authUri = "https://launchpad.swtor.com/launchpad/secure/authenticate?email=${username}"
$response = Invoke-WebRequest -Uri $authUri -Method Post -Body ($body | ConvertTo-Json) -ContentType "application/json" -Verbose -SkipCertificateCheck
Write-Host $response
$result = ($response.Content | ConvertFrom-Json)
$token = $result.token.gameToken
$argmentList = @("-set username ${username}", "-set token ${token}", "-set platform gamepad.swtor.com:443", "-set environment publictest", "-set lang en-us", "-set torsets main;en-us @swtor_dual.icb")
Write-Output $argmentList
Start-Process -FilePath $install.path -ArgumentList $argmentList -WorkingDirectory $install.workingDirectory -Verbose -PassThru -NoNewWindow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment