Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Default cookie setter in OAuth is not setting samesite = None

已关闭
#352 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@Kudze 已经在做这个了。

开始于 2024年7月1日。

  • #353 来自 @Kudze —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
php

调研方向

检查 src/Auth/OAuth.php 第 351 行附近设置 OAuth cookie 的位置,并审查嵌入式 Shopify 管理后台流程中涉及的 cookie 行为。使用 iframe 复现 online-mode 下的令牌交换,或者在 repository 提供测试的情况下添加一个有针对性的测试;当 cookies 被保存且 OAuth 在 Shopify 管理后台中成功时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Issue summary

The samesite parameter is being ommited from setcookie function in OAuth2 process: https://github.com/Shopify/shopify-api-php/blob/main/src/Auth/OAuth.php#L351, causing the default Lax mode to be selected.

This causes "Perform Token Exchange" step in https://shopify.dev/docs/apps/build/authentication-authorization/session-tokens#request-flow-using-a-session-token to fail when embedded page is loaded through an iframe (for example from Shopify admin panel), because the cookies will not be saved.

Expected behavior

The cookies should be set and OAuth should succeed in Shopify admin panel.

Actual behavior

The cookies are not set and OAuth fails in Shopify admin panel.

image

Steps to reproduce the problem

  1. Implement minimal application implementing Shopify's OAuth2 authentication (online mode = true), using this library, with default cookie setter.
  2. Install application into any Shopify store.
  3. Delete the initial customer's session. (Simulating different admin user or expired session).
  4. Try to perform "Token Exchange" from Shopify admin panel.

Reduced test case


Checklist

  • I have described this issue in a way that is actionable (if possible)
  • I have created a merge request fixing this issue.
主要语言
PHP
星标
473
派生
193
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。