OAuth2 Refresh Token Request not working from EPM Groovy Script
Summary: We are facing issue while calling Rest API to generate an OAuth2 token using EPM Groovy script. I am trying to run the following code, but if I try same step in postman it is working fine
1. Step -1 Get Device code (Is working Fine)
Code :
String payload = 'response_type=device_code&scope=urn%3Aopc%3Aidm%3A__myscopes__%20offline_access&client_id=<Clinet ID>'
def headers = ['Content-Type': 'application/x-www-form-urlencoded']
HttpResponse<String> jsonResponse = operation.application.getConnection("OAuth2").post('/oauth2/v1/device').headers(headers).body(payload).asString()
println ("Response: $jsonResponse.body")
OutPut:
Response: {"device_code":"<Device Code>","user_code":"TTFHX","verification_uri":"