Open abhimanusharma opened 3 years ago
Did you figure out why? It doesn't look like an error with the package
Hi @dacastro4 I finally figured out why this happened and solved it with very bad practice. This error come when I try to redirect the app to oauth page with ajax request instead of direct browser based redirection.
I am using Vue.js in the frontend and Laravel in the backend. If you make a simple get request from blade template and redirect it, it will work but if you make a request from frontend env to backend and then redirect it from there, it will throw this error.
I resolved this issue by sending Laravel::check() value (true or false) and based on that I am redirecting to the oauth route using window.location.href
Update: even if I try to use basic $router.push('/oauth/path')
to redirect it, it still do not work. Only window.location.href will work if you are using a js framework in the frontend instead of blade template views.
PS: I have also implemented Draft feature in this package by using core google api client Here
@abhimanusharma Can you show me how to save a mail as a draft using the feature you added on this package?
in my case laravel + angular i solve it like this :
public function getOauthGmailUrl() { $url = LaravelGmail::getAuthUrl(); return response()->json(['url' => $url]); }
Hi this suddenly stopped working, I don't understand the reason.
Access to XMLHttpRequest at 'https://accounts.google.com/o/oauth2/auth?response_type=code&access_type=offline&client_id=499611483462-iabp631md5pcuql3jtm16g60qaprs53m.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Femail&state&scope=https%3A%2F%2Fmail.google.com%2F&approval_prompt=force' (redirected from 'http://localhost:3000/api/gmail/login') from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Yesterday when I pushed the code, everything was working fine but today morning suddenly it stopped working, any idea why?