<commit_before><?php

namespace App\Http\Controllers\Auth;

use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Tymon\JWTAuth\Facades\JWTFactory;

class APITokenController extends Controller
{
    public function getToken(Request $request)
    {
        try {
            $customClaims = ['iat' => time(), 'exp' => time() + 60, 'nbf' => time() - 60, 'sub' => cas()->user()];
            $payload = JWTFactory::make($customClaims);
            $token = JWTAuth::encode($payload)->get();
            return response()->json(compact('token'));
        } catch (JWTException $e) {
            return response()->json(['error' => 'could_not_create_token'], 500);
        }
        return response()->json(['error' => 'could_not_create_token'], 500);
    }
}<commit_msg>Flip JWT token generation to Laravel user<commit_after><?php

namespace App\Http\Controllers\Auth;

use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Tymon\JWTAuth\Facades\JWTFactory;

class APITokenController extends Controller
{
    public function getToken(Request $request)
    {
        try {
            return response()->json(JWTAuth::fromUser(Auth::user()));
        } catch (JWTException $e) {
            return response()->json(['error' => 'could_not_create_token'], 500);
        }
        return response()->json(['error' => 'could_not_create_token'], 500);
    }
}
{'fraction_non_alphanumeric': 0.14932992980216975, 'fraction_numerical': 0.01021059349074665, 'mean_word_length': 3.558139534883721, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4433696', 'n_tokens_mistral': 501, 'n_tokens_neox': 496, 'n_words': 95}