Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function authToken (Request $request) {
- $username = $request->input('username');
- $password = $request->input('password');
- if (Auth::attempt(['email' => $username, 'password' => $password])) {
- $http = new \GuzzleHttp\Client();
- $response = $http->post('http://localhost:8000/oauth/token', [
- 'form_params' => [
- 'grant_type' => 'password',
- 'client_id' => '2',
- 'client_secret' => 'pc4cjW6KEwufFAf31f1HRFFTtL2dOHPmTgDLKR',
- 'username' => $username,
- 'password' => $password,
- 'scope' => '',
- ],
- ]);
- return json_decode((string) $response->getBody(), true);
- } else {
- return 'Email or Password is incorrect';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement