Bom dia.
Ao usar PostMan, consigo iniciar sem erro um processo no Fluig, com autenticação oAuth 1.0.
Via Protheus
Classe fwOAuthClient não gera oauth_signature
Retorno fwOAuthClient
2019-04-10 10:21:16,333 ERROR [com.fluig.auth.FluigAuthenticationMechanism] (default task-8) signature_invalid: net.oauth.OAuthProblemException: signature_invalid
oauth_problem: signature_invalid
oauth_signature:
oauth_signature_base_string: POST&http%3A%2F%2F127.0.0.1%3A8095%2Fbpm%2Fapi%2Fv1%2Fprocesses%2Fped_venda1%2Fstart&oauth_consumer_key%3DuFKE99LWQ8PDdBFQiO6fUhRRLoagFcDT%26oauth_nonce%3Db95044a1feb35f61e6eda0bf6c5b9002%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1554902476%26oauth_token%3D44086614-ac68-48b3-babf-494b8a590a99%26oauth_version%3D1.0
oauth_signature_method: HMAC-SHA1
O protheus tem alguma função que retorna oauth_signature para a classe fwOAuthClient?
Fonte:.
Include 'protheus.ch'
Include "TOTVS.CH"
Include "TopConn.CH"
INCLUDE "TBICONN.CH"
Include 'parmtype.ch'
Include 'RestFul.ch'
user function FFLG006()
local oBody := nil
local cBody := ""
local cResp := ""
local cResult := ""
local cx_url := "http://127.0.0.1:8095/bpm/api/v1/processes/ped_venda1/start"
// post
local cx_ck := "uFKE99LWQ8PDdBFQiO6fUhRRLoagFcDT" // Indica a Consumer Key
local cx_cs := "RGa8MqS4NZtAbWM8Voloi9kSVPg5AoKc5kySZxoYtpkOFgHU" // Indica a Secret Key (Consumer Secret)
local cx_at := "44086614-ac68-48b3-babf-494b8a590a99" // Atribui o token
local cx_as := "05b3385b-22b5-49db-a4ac-dc7416a2b93863658038-fbfe-49d2-82a6-4b9defa34ec4" // Atribui o secret token, ou access token
cAccess := "http://127.0.0.1:8095/portal/api/rest/oauth/access_token"
cRequest := "http://127.0.0.1:8095/portal/api/rest/oauth/request_token "
cAuthorize := "http://127.0.0.1:8095/portal/api/rest/oauth/authorize"
rpcSetEnv ("99", "01", nil, nil, "FAT", nil, nil)
oUrl := FWoAuthURL():New( cRequest , cAuthorize , cAccess )
oClient := fwOAuthClient():new(cx_ck, cx_cs, oUrl, cx_url)
oClient:cOAuthVersion := "1.0"
oClient:cContentType := "Content-Type: application/json"
oClient:setMethodSignature("HMAC-SHA1")
oClient:setToken(cx_at)
oClient:setSecretToken(cx_as)
oClient:makeSignBaseString("POST", cx_url)
cBody:='{'
cBody+='"targetState":0,'
cBody+='"targetAssignee":"fluigadmin",'
cBody+='"subProcessTargetState":0,'
cBody+='"comment":"Teste Protheus",'
cBody+='"formFields":{'
cBody+='"TIPOPED":"1",'
cBody+='"NROPEDIDO":"51"'
cBody+='}'
cBody+='}'
fwJsonDeserialize(cBody, @oBody)
//cResult := oClient:post(cx_url, "", cBody, oClient:aParametros, @cResp, .t.)
cResult := oClient:post(cx_url, "", cBody, , @cResp, .t.)
RESET ENVIRONMENT
return