** Settings ***
Library RequestsLibrary
Library Collections
*** Variables ***
${SERVICE_ROOT} https://xxx.yyy.org/m1/oauth
${SERVICE_NAME} accesstoken
${client_key} 11111111111111111111111111111111111
${client_secret} 2222222222222222222222222222222222222222
*** Test Cases ***
Test 1
Create access token
*** Keywords ***
Create access token
Create Session accessurl ${SERVICE_ROOT} verify=True
&{data_1} Create Dictionary grant_type=client_credentials key=${client_key} secret=${client_secret}
${header} Create Dictionary Content-Type=application/json
${resp} Post Request accessurl /token params=${data_1} headers=${header}
Should be Equal ${resp.status_code} 200
In simple words, I am trying to replicate the POST METHOD from Postman to Robot Framework (Type oauth 2 ) Mandatory parameters are grant type, client id and secret. Expected Authorization: Bearer with access token
Upon executing, I am getting 401 and params returns Empty I had tried all possible ways to generate the token by making changes in the code but all proved to be unsuccessful. Kindly help me to fix this and let me know what error I have made, I am very new to automation scripting.
Solution:
Referred How to generate oauth 2.0 token using "Create Client Oauth2 Session" keyword in robot framework
The above worked.