Hi Williaml, can you also kindly look at my another questions?
Question on Oauth2 Resource Owner Password Credential Grant in R httr
I use Oauth2 authorization to get the token for REST API. I tested the setting in SoapUI and it is working with the Resource Owner Password Credential Grant, as shown below.
Now, I want to retrieve the token through R httr library, but I don’t know how to set the resource owner name and password in the R code. Here is my Code
r <- POST("https://XXXXXXX.com/authservice/connect/token",
config = list(),
body = list(
# grant_type = "RESOURCE_OWNER_PASSWORD_CREDENTIALS",
grant_type = "resource_owner_credentials",
resourceOwnerName = "ResourceName",
resourceOwnerPassword = "Resourcepwd",
# resource_Owner_Name = "ResourceName",
# resource_Owner_Password = "Resourcepwd",
# resourceOwner_Name = "ResourceName",
# resourceOwner_Password = "Resourcepwd",
# resource_OwnerName = "ResourceName",
# resource_OwnerPassword = "Resourcepwd",
# resource_Name = "ResourceName",
# resource_Password = "Resourcepwd",
# resource_id = "ResourceName",
# resource_secret = "Resourcepwd",
client_id = "ClientIDname",
client_secret = "Clientpassword",
scope = "xxxGroup"
encode = "form"
I got a 400 error ("unsupported_grant_type" and bad request). I am guessing there may be something wrong with the syntax on the resource onwer name and password, so I also tried all the possible combinations that I commented in above code but they all failed.
My question is, are the parameter names for both resource owner name and password predefined by the API document, or they are the fixed names in R-httr, regardless what token authorization service?
Can someone help to take a look at? Any input is greatly appreciate!
This question also can be found here: