How to write cURL requests to wso2 -


i trying connect wso2 api created using rest.

$userdata = array("username" => "user", "password" => "password"); $ch = curl_init("http://wso2.endpoint.com"); curl_setopt($ch, curlopt_customrequest, "post"); curl_setopt($ch, curlopt_postfields, json_encode($userdata)); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpheader, array("content-type: application/json","authorization: bearer concernpart", "content-lenght: " . strlen(json_encode($userdata))));  $token = json_decode(curl_exec($ch)); 

now not sure how write "authorization: bearer concernpart". need add statically in each request? how change in requests if change bearer token or regenerate it.

or there way can hit wso2 , bearer token , use in requests.

what need call token endpoint using preferred grant type , new access_token. can use access token actual api call. refer wso2 doc on how obtain access token


Comments

Popular posts from this blog

The SDK directory does not exist (ubuntu 16.04) (react native) -

python - How to clone or copy a list? -

Convert excel to pdf with VBScript -