设置环境变量的Postman脚本

设置环境变量的Postman脚本,postman,Postman,我正在为一个API与我们的服务集成创建一个postman集合。这里我们使用OAuth1.0进行身份验证。我想将oauth init responseoauth_token,oauth_token_secret设置到postman环境变量中,以便在进一步的请求中访问它们。 响应的格式如下,而不是JSON。 oauth\u令牌=oauth\u令牌\u值和oauth\u令牌\u秘密=oauth\u令牌\u秘密\u值和oauth\u回调\u确认=真 我尝试了以下脚本: var output = requ

我正在为一个API与我们的服务集成创建一个postman集合。这里我们使用OAuth1.0进行身份验证。我想将oauth init responseoauth_tokenoauth_token_secret设置到postman环境变量中,以便在进一步的请求中访问它们。 响应的格式如下,而不是JSON。 oauth\u令牌=oauth\u令牌\u值和oauth\u令牌\u秘密=oauth\u令牌\u秘密\u值和oauth\u回调\u确认=真

我尝试了以下脚本:

var output = require('querystring').parse(Response.text);
postman.setGlobalVariable("oauth_token", output.oauth_token);
postman.setGlobalVariable("oauth_token_secret", output.oauth_token_secret); 
有人能帮我把令牌设置成postman环境变量吗


注意:我使用的是chrome插件版本5.5.4,而不是本机应用。

在chrome扩展中,您需要使用
postman.setEnvironmentVariable()


为此,您需要创建并选择一个环境(无需手动添加任何变量)。这里介绍了如何做到这一点:

在chrome扩展中,您需要使用
postman.setEnvironmentVariable()


为此,您需要创建并选择一个环境(无需手动添加任何变量)。这里介绍了如何做到这一点:

使用本机应用程序。使用本机应用程序。
postman.setEnvironmentVariable("oauth_token", output.oauth_token);
postman.setEnvironmentVariable("oauth_token_secret", output.oauth_token_secret);