问题描述
测试API和使用PowerShell的新功能。我可以获取我的access_token。我不知道如何发布或从那里去。
我正在测试要运行的站点API并为我提供访问令牌,然后使用WP-Oauth服务器,我应该可以在Web浏览器中运行并下载序列号文件。
有人可以指出我正确的方向吗?我知道我需要使用“ POST”,但不知道如何。
PS C:\windows\system32> set-location "C:\Users\linds\Documents\TSC API\Server-demo" PS C:\Users\linds\Documents\TSC API\Server-demo> $clientId = "hapmA0MCuIVNmRmkwKWLBq8i5fOs4C1QbZ2s4ztB";
>> $secret = "Q6mlmdt5KVwFZcUqbgAElca8MGtstFxU5RVdlxVh";
>> $username = "username";
>> $password= "password";
>> $redirectURI = "https://tsc.com/server-demo/";
>>
>> $tokenParams = @{
>> client_id=$clientId;
>> client_secret=$secret;
>> grant_type='password';
>> username=$username;
>> password=$password;
>> redirect_uri=$redirectURI
>> }
>>
>> $token = Invoke-WebRequest -Uri "https://tsc.com/server-demo/oauth/token/" -Method POST -Body $tokenParams | ConvertFrom-Json
>>
>> # Save this
>> Write-Host "Redirct URL:" $redirectURI
>> Write-Host "Access Token:" $token.access_token
>> Write-Host "Token Expires in (seconds):" $token.expires_in
>>
>>
Redirct URL: https://tsc.com/server-demo/
Access Token: daeusdkd30lxaialgpp92gvieukdnmn0zrrxrcrl
Token Expires in (seconds): 3600
PS C:\Users\linds\Documents\TSC API\Server-demo>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)