laravel-gmail icon indicating copy to clipboard operation
laravel-gmail copied to clipboard

LaravelGmail::check() returning null after redirection

Open abhimanusharma opened this issue 3 years ago • 3 comments

Hi there,

I am simply using LaravelGmail::makeToken() and then redirecting is to inbox dashboard.

What happening is after successful login I have action in my controller

public function gmailCallback() {
LaravelGmail::makeToken();
LaravelGmail::check(); // here it is returning true

return redirect()->route('dashboard');
}

Here is my action dashboard which is linked with route name dashboard

public function dashboard() {
LaravelGmail::check(); // here it is false
}

UPDATE: The token is not getting saved in /storage/app/gmail/tokens/gmail-json.json The permission I set is using below command:

sudo chmod -R 775 storage
sudo chown -R abhimanu:www-data storage

PS: Also I think this package only works for single user, what if another user login using same CRM, will the first user logged out automatically from the system? What if multiple users are logging in at the same time?

abhimanusharma avatar Feb 24 '21 04:02 abhimanusharma

Please try to add \ before LaravelGmail like this \LaravelGmail

cntabana avatar Feb 25 '21 02:02 cntabana

@cntabana Its all because of its token saving strategy. I think this package should provide migration to save config and token in database instead of json file. So that in app ajax call will not effect its working.

abhimanusharma avatar Mar 12 '21 11:03 abhimanusharma

You might be right. Sounds like a good feature to have.

dacastro4 avatar Mar 12 '21 15:03 dacastro4