Commit 7a36ec23 authored by Iswahyudi's avatar Iswahyudi

Perubahan userview menggunakan Barrier Authorization

parent 4a98833e
Pipeline #25544 passed with stages
in 7 minutes and 3 seconds
......@@ -51,6 +51,7 @@ class Login extends CI_Controller {
} else {
$result = json_decode($result);
$this->session->set_userdata('nama',$result->name);
$this->session->set_userdata('token',$result->token);
if ($result->userRole->name=='Administrator') {
$this->session->set_userdata('isLogin',1);
} else
......
......@@ -229,9 +229,10 @@ class Users extends CI_Controller {
//create a new cURL resource
$ch = curl_init($this->urluser);
//penambahan bearer token
$authorization = "Authorization: Bearer ".$this->session->userdata('token');
//set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', $authorization));
//return response instead of outputting
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment