{"id":13466781,"url":"https://github.com/funkhaus/wp-graphql-cors","last_synced_at":"2025-03-26T00:31:27.153Z","repository":{"id":35904641,"uuid":"219808356","full_name":"funkhaus/wp-graphql-cors","owner":"funkhaus","description":"Makes WP GraphQL's authetication \"just work\". It does this by customizing the CORS headers.","archived":false,"fork":false,"pushed_at":"2023-10-03T01:34:38.000Z","size":89,"stargazers_count":115,"open_issues_count":3,"forks_count":21,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-25T04:15:56.915Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/funkhaus.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}},"created_at":"2019-11-05T17:54:16.000Z","updated_at":"2025-02-08T15:00:50.000Z","dependencies_parsed_at":"2024-01-28T16:55:02.550Z","dependency_job_id":null,"html_url":"https://github.com/funkhaus/wp-graphql-cors","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkhaus%2Fwp-graphql-cors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkhaus%2Fwp-graphql-cors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkhaus%2Fwp-graphql-cors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkhaus%2Fwp-graphql-cors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/funkhaus","download_url":"https://codeload.github.com/funkhaus/wp-graphql-cors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245566098,"owners_count":20636390,"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":[],"created_at":"2024-07-31T15:00:49.969Z","updated_at":"2025-03-26T00:31:26.803Z","avatar_url":"https://github.com/funkhaus.png","language":"PHP","funding_links":[],"categories":["Plugins"],"sub_categories":["WordPress"],"readme":"# WP GraphQL CORS\n\nThe primary purpose of this plugin is to make the [WP GraphQL](https://github.com/wp-graphql/wp-graphql) plugin authentication \"just work\". It does this by allowing you set the CORS headers that GraphQL will accept, which means that WordPress's default authentication cookies will be accepted.\n\nThis means that if a user is logged into WordPress, they will be able to see things like draft and private pages/posts via GraphQL.\n\n## Features\n\n- Allows WP-GraphQL to accept default WordPress cookies\n- Works across multiple domains (so you can have multiple frontends connected to one backend)\n- Allows you to filter out specific cookies for added security (perhaps you don't want to use this for WordPress authentication but do want to access other cookies)\n- Allows you to customize the GraphQL endpoint\n- Extends WP GraphQL to have a logout and login mutation\n- Allows you to filter out which cookies are allowed\n\n## Installation\n\n1.  Requires [WP GraphQL](https://github.com/wp-graphql/wp-graphql).\n1.  Upload this plugin to WordPress.\n1.  Config your GraphQL client (probably Apollo) to include credentials in requests. Generally this is a setting under `httpLinkOptions` and look to set `credentials = \"include\"`.\n\nNow if the browser is currently logged into WordPress, WP GraphQL will allow access to authenticated data.\n\n## Documentation\n\nIf all you want to do is allow draft, private and page previews to be viewed from the frontend, setting `Send site credentials.` and `Add Site Address to \"Access-Control-Allow-Origin\" header` to true will do this.\n\nYou'll also need to config your GraphQL client (probably Apollo) to include credentials in requests. Generally this is a setting under `httpLinkOptions` and look to set `credentials = \"include\"`.\n\n### Logout Mutation\n\nIf enabled in the settings, WP GraphQL will have a new mutation available to allow a user to logout. This is useful if you want to build a \"logout\" button on a sites frontend.\n\n```\nmutation {\n    logout(input: {clientMutationId = \"anything unique\"}){\n        clientMutationId\n        status\n    }\n}\n```\n\n### Login Mutation\n\nIf enabled in the settings, WP GraphQL will have a new mutation available to allow a user to login.\n\n```\nmutation {\n\tloginWithCookies(input: {clientMutationId: \"\", login: \"\", password: \"\"}) {\n        clientMutationId\n        status\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunkhaus%2Fwp-graphql-cors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffunkhaus%2Fwp-graphql-cors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunkhaus%2Fwp-graphql-cors/lists"}