{"id":22264309,"url":"https://github.com/jdev29/gmail-oauth2-mailer","last_synced_at":"2026-04-29T08:03:57.831Z","repository":{"id":266151235,"uuid":"897548662","full_name":"jdev29/gmail-oauth2-mailer","owner":"jdev29","description":"Este es un proyecto demo de cómo enviar correos con Gmail usando Oauth2 de Google.","archived":false,"fork":false,"pushed_at":"2024-12-03T00:01:17.000Z","size":187,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T12:47:14.497Z","etag":null,"topics":["gmail","gmail-api","google","google-api","google-auth","googleclient","laravel","oauth2","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdev29.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-02T20:25:12.000Z","updated_at":"2024-12-03T04:26:53.000Z","dependencies_parsed_at":"2024-12-02T21:42:40.150Z","dependency_job_id":null,"html_url":"https://github.com/jdev29/gmail-oauth2-mailer","commit_stats":null,"previous_names":["jdev29/gmail-oauth2-mailer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdev29%2Fgmail-oauth2-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdev29%2Fgmail-oauth2-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdev29%2Fgmail-oauth2-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdev29%2Fgmail-oauth2-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdev29","download_url":"https://codeload.github.com/jdev29/gmail-oauth2-mailer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245476718,"owners_count":20621698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gmail","gmail-api","google","google-api","google-auth","googleclient","laravel","oauth2","php"],"created_at":"2024-12-03T10:08:31.273Z","updated_at":"2026-04-29T08:03:52.811Z","avatar_url":"https://github.com/jdev29.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Gmail OAuth2 Mailer\n\nEste es un proyecto demo de cómo enviar correos con Gmail usando Oauth2 de Google.\n\n### **1\\. Habilitar Gmail API**\n\n1.  Ve a la Google Cloud Console.\n    \n2.  Crea un proyecto o selecciona uno existente.\n    \n3.  Habilita la **Gmail API**:\n    \n    *   En el menú \"APIs y servicios\", selecciona \"Biblioteca\".\n        \n    *   Busca \"Gmail API\" y haz clic en \"Habilitar\".\n        \n4.  Configura credenciales:\n    \n    *   En \"APIs y servicios\" \u003e \"Credenciales\", haz clic en \"Crear credenciales\".\n        \n    *   Selecciona \"ID de cliente OAuth\".\n        \n    *   Configura una pantalla de consentimiento de OAuth:\n        \n        *   Llena los campos requeridos, como el nombre de la aplicación y la información de contacto.\n            \n    *   Selecciona el tipo de aplicación, como \"Aplicación web\".\n        \n    *   Proporciona un URI de redirección. Por ejemplo: http://localhost:8080/oauth2-callback\n\n### **2\\. Configurar variables de entorno**\n\nEn el archivo .env, agrega las credenciales de OAuth2 y la configuración de Gmail:\n\n```\nMAIL_MAILER=gmail\nMAIL_HOST=smtp.gmail.com\nMAIL_PORT=587\nMAIL_FROM_ADDRESS=user@gmail.com\nMAIL_USERNAME=user@gmail.com\nMAIL_FROM_NAME=\"Support Team\"\nMAIL_ENCRYPTION=tls\nMAIL_SUPPORT_TEAM=user@gmail.com\n\nGMAIL_CLIENT_ID=xxxxxxxx.apps.googleusercontent.com\nGMAIL_CLIENT_SECRET=xxxxxxxx\nGMAIL_ACCESS_TOKEN=xxxxxxxx\nGMAIL_REFRESH_TOKEN=xxxxxxxx\nGMAIL_REDIRECT_URI=http://localhost:8080/oauth2-callback\n```\n\n\u003e **Nota:** MAIL\\_PASSWORD se deja como null porque usarás OAuth2 para autenticarte.\n\n## **3\\.Excluir la verificación CSRF (Solo por temas prácticos)**\napp/Http/Middleware/VerifyCsrfToken.php\n```\nprotected $except = [\n    '/mail-test', // Añadir esta línea\n];\n```\n## **3\\. Obtener Authorization URL**\n\nCorrer el proyecto usando:\n```php artisan serve --host=localhost --port=8080```\n\nEntrar a siguiente URL (verificar antes tu puerto actual puerto):\n\u003e http://localhost:8080/oauth2-callback\n\nEsto generará una URL de autorización, copiar e ingresar al navegador, nos traerá el access token y refresh token, esos dos datos copiarlos al .env:\n\n```\nGMAIL_ACCESS_TOKEN=xxxxx\nGMAIL_REFRESH_TOKEN=xxxxx\n````\n\n## **4\\. Probar el proyecto**\n\nPor último, para fines prácticos, abrir Postman y hacer la siguiente petición mediante post:\n\nPOST:\n\u003e http://127.0.0.1:8080/mail-test\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdev29%2Fgmail-oauth2-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdev29%2Fgmail-oauth2-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdev29%2Fgmail-oauth2-mailer/lists"}