2017-12-20 34 views
0

OAUTH2 인증을 사용하는 API에서 RequestsLibrary를 사용하려고 시도하지만 400을 throw 할 때마다! = 200.OAuth2를 사용하는 API에 대한 RequestsLibrary

Get authToken 

    Create Session test http://brentertainment.com/oauth2/ 
    ${data}=  Create Dictionary  grant_type= 'password'  client_id=demoapp  client_secret=demopass  username= 'demouser' password='testpass' 
    ${headers}=  Create Dictionary Content-Type= 'application/x-www-form-urlencoded' 
    ${resp}= post request  test  /lockdin/token  ${headers}  ${data} 
    Should Be Equal As Strings ${resp.status_code}  200 

도움이 되겠습니다.

+0

을 사용하면 온라인 테스트의 OAuth 서버를 사용하는 예를 수정할 수 있습니다 액세스 할 수 없습니다? 이렇게하면 우리는 당신을 더 잘 도울 수 있습니다. –

+0

@ A.kootstra 데모 oauth 서버로 예제를 업데이트했지만 현재 404가 표시됩니다. 어디서 잘못 될지 잘 모르겠습니다. –

답변

0

내가 OAuth를 서버로 확장 요청 라이브러리 대신의 요청 라이브러리

*** Settings *** 
Library ExtendedRequestsLibrary 

*** Test Cases *** 
Post Request With Password 

    Create Password OAuth2 Session member http://token  client_id client_secret username password scope base_url 
    ${var} = get request  member /abc 
    Log ${var.content}