Oauth 2.0 机器人框架,自动更新承载令牌?

Oauth 2.0 机器人框架,自动更新承载令牌?,oauth-2.0,robotframework,web-api-testing,Oauth 2.0,Robotframework,Web Api Testing,我不熟悉API自动化。期待您的专家指导 场景:在执行所有API测试之前,我必须获取访问令牌并更新它 下面是我试过的代码 *** Settings *** Library RequestsLibrary *** Variables *** ${clientID} &&&&&&&& ${client_secret} &&&&&&& ${endp

我不熟悉API自动化。期待您的专家指导

场景:在执行所有API测试之前,我必须获取访问令牌并更新它

下面是我试过的代码

*** Settings ***
Library           RequestsLibrary
*** Variables ***
${clientID}       &&&&&&&&
${client_secret}    &&&&&&&
${endpoint}       https://xxxxxx.xxxxxxx
*** Test Cases ***
${access_token}=  get oAuth Token
*** Keywords ***
get oAuth Token
set test variable    ${request_uri}    /oauth2/token
create session    bearer_session    ${endpoint}    verify=True
&{headers}=    create dictionary    Content-Type=application/json    Accept=application/json
${request_data}=    create dictionary    client_id=${clientID}    client_secret=${client_secret}    grant_type=client_credentials
${response}=    post request    bearer_session    ${request_uri}    data=${request_data}    headers=${headers}
should be equal as strings    200    ${response.status_code}    msg=Response status should be "200" but is    ${response.status_code}.
${response_json}= to json ${response.content}
log to console ***********************************************
log to console ${response_json['access_token']}
log to console ***********************************************
[return] ${response_json['access_token']}enter code here
当我执行此操作时,我得到一个错误,如下所示

"message":"Required String parameter 'xyz' is not present","path":"/xxxx/oauth2/token"} 
在这种情况下,我应该如何构造我的POST请求

我们将非常感谢你的帮助

多谢各位