PSTwitterAPI似乎无法从Visual Studio中进行身份验证

时间:2020-01-22 21:24:57

标签: linux powershell twitter oauth twitter-oauth

script

Import-Module PSTwitterAPI

Set-TwitterOAuthSettings -ApiKey $env:ApiKey -ApiSecret $env:ApiSecret -AccessToken $env:AccessToken -AccessTokenSecret $env:AccessTokenSecret

Get-TwitterUsers_Lookup -screen_name 'mkellerman'

从控制台运行时的警告:

PS /home/thufir/powershell/helloPSTwitterAPI> 
PS /home/thufir/powershell/helloPSTwitterAPI> ./twitter.ps1
WARNING: OAuthSettings with AccessToken '123' already exists.

id  
...
translator_type                    : none


PS /home/thufir/powershell/helloPSTwitterAPI> 

从Visual Studio代码运行时出错:

PowerShell Integrated Console

PS /home/thufir> /home/thufir/powershell/helloPSTwitterAPI/twitter.ps1


Invoke-RestMethod : {"errors":[{"code":215,"message":"Bad Authentication data."}]}
At /home/thufir/.local/share/powershell/Modules/PSTwitterAPI/0.0.7/public/Invoke-TwitterAPI.ps1:34 char:5
+     Invoke-RestMethod @RestMethod_Params
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Method: GET, Reques\u2026PowerShell/6.2.3
}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Invoke-RestMethod : {"errors":[{"code":215,"message":"Bad Authentication data."}]}
At /home/thufir/.local/share/powershell/Modules/PSTwitterAPI/0.0.7/public/Invoke-TwitterAPI.ps1:34 char:5
+     Invoke-RestMethod @RestMethod_Params
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Method: GET, Reques\u2026PowerShell/6.2.3
}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
PS /home/thufir> 

当直接从bash控制台运行时,只是忽略警告吗?但是,为什么从Visual Studio中运行时它会崩溃?

0 个答案:

没有答案