Hi, I need to consume a webservice from a client and first I need to get a token using OAuth2 Basic header authentication.
I got this code, but I'm getting 401 Unauthorized:
vClientID = $encode("URL", "client-id")
vClientSecret = $encode("URL", "client-secret")
vScope = $encode("URL", "scope")
vURI = "https://uri.com/oauth2/token?grant_type=client_credentials&scope=%%vScope"
vBasicAuth = $encode("BASE64", "%%vClientID%%%:%%vClientSecret")
putitem/id vHeaders, "Accept", "application/json"
putitem/id vHeaders, "Authorization", "Basic: %%vBasicAuth"
putitem/id vHeaders, "Content-Type", "application/x-www-form-urlencoded"
vContent = ""
newinstance "UHTTP", vUHTTP
vUHTTP->set_flags(3)
vUHTTP->send(vURI, "POST", "", "", vHeaders, vContent, vResponse)
I'm not sure if this is right, when I tested it with postman it returns the token.
Regards
------------------------------
Alejandro Blanco Uribe
Compuamerica C.A.
------------------------------