GitHub!

Projenin GitHub Sayfası https://github.com/smcn/.

POST https://omuservices.omu.edu.tr/login

GuzzleHttp Örnek

function getJWTToken() { $response = $this->client->request('POST', $this->baseApiURL .'login', [ 'form_params' => ['email' => $this->email, 'password' => $this->password], 'verify' => false ] ); $token = json_decode($response->getBody(), true); return $this->token = (isset($token['token'])?$token['token']:''); }

AngularJS Örnek

myobject = { 'email': Users.email, 'password': Users.password }; return $http({ method: 'POST', headers: { "content-type": "application/json", "accept": "application/json" }, url: $rootScope.serviceBaseURL + 'login', data: myobject }).success(function (data, status) { tokenPayload = jwtHelper.decodeToken(data.token); $window.localStorage.setItem('token', data.token); }).error(function (data, status, headers, config) { console.log("Hata: " + JSON.stringify({ data: data })); });

Doğrulayıcı!

$validator = Validator::make($request->all(), [ 'name' => 'required|string|max:255', 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6', 'role' => 'required|string|max:255', ]);

Hatalar!

{ "status": "Invalid Credentials" } , { "status": "User is passive" } , { "status": "Could Not Create Token" }

Başarılı!

{ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.ey..." }