Skip to content
Discussion options

You must be logged in to vote

I'm not sure what the problem in your script might be, but I think it's the missing conversion to JSON of the body values. I think it's the only difference.
I got no issue with this Powershell script, which is a 1:1 translation of your Python script.

$uri = 'https://api.trakt.tv/oauth/token'

$body = @{
    refresh_token  = "YOUR_CURRENT_REFRESH_TOKEN"
    client_id      = "YOUR_CLIENT_ID"
    client_secret  = "YOUR_CLIENT_SECRET"
    redirect_uri   = "urn:ietf:wg:oauth:2.0:oob"
    grant_type     = "refresh_token"
} | ConvertTo-Json

$headers = @{
    "Content-Type" = "application/json"
}

try {
    $response = Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Body $body

    $…

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@tysonkerridge
Comment options

@greatvc
Comment options

@greatvc
Comment options

@henrikfroehling
Comment options

Answer selected by greatvc
@greatvc
Comment options

@tysonkerridge
Comment options

@kevincador
Comment options

@greatvc
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants