Can you figure out why?
Working fine, but is the the best way ?
Any idea how to refresh jwt token by refresh token?
Sorry, but what you mean?
But auth me needs valid jwt token, is that right?
Well, if the me needs valid token how to pass it then?
Register, login routes are not put inside Auth middleware right?
Schema::create(‘papers’, function (Blueprint $table) {
$table->increments(‘id’);
$table->integer(‘user_id’)->unsigned();
$table->foreign(‘user_id’)->references(‘id’)->on(‘users’)->onDelete(‘cascade’);
$table->text(‘author’);
$table->text(‘institution’);
$table->text(‘paper_title’);
$table->string(‘paper_filename’);
$table->smallInteger(‘status’)->default(0);
$table->dateTime(‘moderated_at’)->nullable();
$table->timestamps();
});
I tried to fill the form and submit the data to my table and I got this error: “Call to a member function store() on null” please help
for more detail I attached my controller script and view blade on image at thetop:

Clue: compare controller line 40 with form line 34.
πππ great solution with explaination brother!!
Clue: compare controller line 40 with form line 34.
If this is so…. the forms enctype needs to be multipart….
Thanks so much.
There’s nothing wrong with that. I have told you the lines to check and correct
It’s not my code I was just contributing
OK.
Clue: compare controller line 40 with form line 34.
My mistakeπ . I already fix it, thanks alot for your help
With Vue and api
Vue.mixin({
data: function () {
return {
jwt_token: localStorage.getItem(‘access_token’),
status: false
}
},
methods: {
doLogout(){
localStorage.removeItem(‘access_token’)
// this.$router.push(‘/’)
},
isLogged() {
if (this.jwt_token) {
this.status = true
return this.status
}
return this.status
}
}
})
And this in logout.vue
export default {
created() {
console.log(‘THIS LOGOUT PAGE’);
axios.post(url,
axios.defaults.headers.common[‘Authorization’] = ‘Bearer ‘ + this.jwt_token
)
.then(response => {
this.doLogout()
console.log(‘User is logged out’)
})
.catch(error => {
this.doLogout()
console.log(‘User is logged out with errors’)
})
}
}
Working fine, but is the the best way ?
Recently I’ve found out an interesting validation rule for form fields in Laravel, and I want to briefly tell you about it.
public function refreshTokenV2 () {
$http = new GuzzleHttpClient;
$response = $http->post(url(‘oauth/token’), [
‘form_params’ => [
‘grant_type’ => ‘refresh_token’,
‘refresh_token’ => request(‘refresh_token’),
‘client_id’ => ‘2’,
‘client_secret’ => ‘cK13jXYdcIjETs7yKO8wpkvFGoZhN6WgEex9eCbB’,
// ‘scope’ => ”,
],
]);
return json_decode((string) $response->getBody(), true);
}
“message”: “Unauthenticated.”
Unauthenticated
You passed the refresh route through Auth middleware.
Ihave a one question please help me
I will send a 3 photos of codes
Anyone who says the answer
Thanks

Photo from Amir
This is error

Photo from Amir

Photo from Amir
This is the post model
This is the category model
Yes
I think you have declared your relationship wrongly. Posts will belong to category, yes but photo will belong to post, not the otherwise way round
Register, login routes are not put inside Auth middleware right? Why? Cos as at the time of hitting these routes there is no way to authenticate. So also refresh token.
1. Hit the register route with json data for registration, the controller registers you, generate token and return it to user. From here, user do not need to login. Access the secured routes with the token
2. Login with your username and password, and get Token. Use the token to access secure routes.
3. If token expires, you are logged out. Relogin to generates new token.
Check the chmod and chown
1. Hit the register route with json data for registration, the controller registers you, generate token and return it to user. From here, user do not need to login. Access the secured routes with the token
2. Login with your username and password, and get Token. Use the token to access secure routes.
3. If token expires, you are logged out. Relogin to generates new token.
But this not a good practice, user always need to login, and jwt should not remain valid for long time
i already give persmission for 775