• Dmitry Losyankov
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi guys. I'm new at powershell and scripting, need some help.

I try to authenticate in developers edition by Username-Password OAuth and get list of recources (for example)

I can get access_token succesfully, but next step returned error 400 (bad request)
This is my code:

$url = "https://login.salesforce.com/services/oauth2/token"

$postParams = @{
                grant_type = "password"
                client_id = "[Consumer Key]"
                client_secret = "[1578651120116368499]"
                username = "[useremail]"
                password = "[password+securitytoken]"
               }

$result = Invoke-RestMethod -Uri $url -Method POST -Body $postParams
$access_token = $result.access_token 

$url2 = "https://eu6.salesforce.com/services/data/v37.0/limits/"

$var = Invoke-RestMethod -Uri $url2 -Headers @{"Authorization" = "Bearer " + $access_token}

Please, could you help with this task?
Hi guys. I'm new at powershell and scripting, need some help.

I try to authenticate in developers edition by Username-Password OAuth and get list of recources (for example)

I can get access_token succesfully, but next step returned error 400 (bad request)
This is my code:

$url = "https://login.salesforce.com/services/oauth2/token"

$postParams = @{
                grant_type = "password"
                client_id = "[Consumer Key]"
                client_secret = "[1578651120116368499]"
                username = "[useremail]"
                password = "[password+securitytoken]"
               }

$result = Invoke-RestMethod -Uri $url -Method POST -Body $postParams
$access_token = $result.access_token 

$url2 = "https://eu6.salesforce.com/services/data/v37.0/limits/"

$var = Invoke-RestMethod -Uri $url2 -Headers @{"Authorization" = "Bearer " + $access_token}

Please, could you help with this task?
Hi guys. I'm new at powershell and scripting, need some help.

I try to authenticate in developers edition by Username-Password OAuth and get list of recources (for example)

I can get access_token succesfully, but next step returned error 400 (bad request)
This is my code:

$url = "https://login.salesforce.com/services/oauth2/token"

$postParams = @{
                grant_type = "password"
                client_id = "[Consumer Key]"
                client_secret = "[1578651120116368499]"
                username = "[useremail]"
                password = "[password+securitytoken]"
               }

$result = Invoke-RestMethod -Uri $url -Method POST -Body $postParams
$access_token = $result.access_token 

$url2 = "https://eu6.salesforce.com/services/data/v37.0/limits/"

$var = Invoke-RestMethod -Uri $url2 -Headers @{"Authorization" = "Bearer " + $access_token}

Please, could you help with this task?