Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent Session Cookie Value While Embedded Mode Allows Fallback #1206

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
## Unreleased

- [#1183](https://github.com/Shopify/shopify-api-ruby/pull/1189) Added string array support for fields parameter in Webhook::Registry
- [#1206](https://github.com/Shopify/shopify-api-ruby/pull/1206) Fixes the issue of empty cookie sessions when using embedded mode.

## 13.1.0

Expand Down
15 changes: 4 additions & 11 deletions lib/shopify_api/auth/oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,10 @@ def validate_auth_callback(cookies:, auth_query:)

session = create_new_session(session_params, auth_query.shop)

cookie = if Context.embedded?
SessionCookie.new(
value: "",
expires: Time.now,
)
else
SessionCookie.new(
value: session.id,
expires: session.online? ? session.expires : nil,
)
end
cookie = SessionCookie.new(
value: session.id,
expires: session.online? ? session.expires : nil,
)

{ session: session, cookie: cookie }
end
Expand Down