Comments (25)
So anyone that is having issues with laravel on this point
Turn off cookie encryption in Http/Middleware/EncryptCookies.php
protected $except = [
'shopify_session_id',
'shopify_session_id_sig',
];
from shopify-api-php.
If you are using Laravel, try replacing $request->cookie() with $_COOKIE like this:
OAuth::callback($_COOKIE, $request->query());
For some reason, the Shopify cookies are returned as null when using $request->cookie() to retrieve them.
from shopify-api-php.
I fix it by adjusting the code like this:
Route::get('/api/auth/callback', function (Request $request) {
try {
$cookies = $request->cookie();
if ($request->cookie() == null) {
$cookies = $_COOKIE;
}
$session = OAuth::callback(
$cookies,
$request->query(),
['App\Lib\CookieHandler', 'saveShopifyCookie'],
);
} catch (Exception $e) {
Log::warning('Failed to authenticate: ' . $e->getMessage());
return redirect('/api/auth?shop=' . $request->query('shop'));
}
...
from shopify-api-php.
Hi,
I am also dealing with the same issue
Could you please let me know what are you passing in $cookie?
from shopify-api-php.
@pvkhanh1708 how did you get that $cookies variable?
from shopify-api-php.
@pvkhanh1708 Where you able to resolve this issue? I'm currently having the same issue.
from shopify-api-php.
I am not passing this step, so I decided to use another package
from shopify-api-php.
I also encountered this error when submitting a listing check when using the officially provided cli library.
Shopify\Exception\CookieNotFoundExceptionCould not find the current session id in the cookies
Can you think that the officially provided sample cli is just a useless template that has not undergone any review and is just for normal users to complete the normal installation process ? Should I use the official template as the base template for developing an app?
from shopify-api-php.
Hey this is how im setting my cookies in /auth route
return redirect(OAuth::begin($request->query('shop'), '/auth/callback', false, function (OAuthCookie $cookie) use ($request) {
Cookie::queue($cookie->getName(), $cookie->getValue(), $cookie->getExpire(), '/', env('SHOPIFY_APP_HOST_NAME'),
$request->secure());
return true;
}));
When redirect to /auth/callback, this is how im creating the session.
$shopSession = OAuth::callback($request->cookie(), $request->query());
When I install the app for the first time it seems to be working fine, but when I try to install for the second time.
from shopify-api-php.
i have the same question, do you resolve it ?
from shopify-api-php.
Hey this is how im setting my cookies in /auth route
return redirect(OAuth::begin($request->query('shop'), '/auth/callback', false, function (OAuthCookie $cookie) use ($request) { Cookie::queue($cookie->getName(), $cookie->getValue(), $cookie->getExpire(), '/', env('SHOPIFY_APP_HOST_NAME'), $request->secure()); return true; }));
When redirect to /auth/callback, this is how im creating the session.
$shopSession = OAuth::callback($request->cookie(), $request->query());
When I install the app for the first time it seems to be working fine, but when I try to install for the second time.
set setCookieFunction = null, it work for me
from shopify-api-php.
Hi, if you have modified the store table then there is a error on the save store query function on app/app/Lib/DbSessionStorage.php at line 89, insert all your field which don't have default value will fix this issue.
from shopify-api-php.
Same issue here. Has anybody found any way to solve this?
from shopify-api-php.
Hi, are you guys sure you've a SSL certificate installed? (Https?). Otherwise I believe the default setcookie function will not set the cookies.
from shopify-api-php.
I am getting these errors randomly as well, quite difficult to debug.
from shopify-api-php.
If you kept the app screen until your cookie is invalidated you have this issue, in my case, I send the customer back to the /login page to generate another section, so it's almost imperceptible.
from shopify-api-php.
Any update on it?
from shopify-api-php.
Do we have any solution to this issue?
from shopify-api-php.
Use offline session
from shopify-api-php.
I am facing this issue when I add additional scopes to the app.
from shopify-api-php.
I am facing this issue when I add additional scopes to the app.
reinstall the app
from shopify-api-php.
Try to use another API version, try to use 01-2023. It seems to be related to the Oauth compatibilities.
from shopify-api-php.
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.
from shopify-api-php.
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.
from shopify-api-php.
We are closing this issue because it has been inactive for a few months.
This probably means that it is not reproducible or it has been fixed in a newer version.
If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.
If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines
Thank you!
from shopify-api-php.
Related Issues (20)
- Shopify\Exception\MissingArgumentException: Missing Authorization key in headers array in file HOT 7
- Need Support On First Steps Of Using PHP REST API Library HOT 13
- A new release of the Shopify API is due soon HOT 2
- A new release of the Shopify API occurred HOT 4
- 2023-07 API release not available in PHP SDK HOT 1
- Library assumes all responses are JSON structured - they aren't HOT 5
- Shopify PHP SDK Docs Example gives Syntax error: unexpected token '{'PHP HOT 3
- Issue getting started HOT 3
- Undefined index: HTTP_X_SHOPIFY_HMAC_SHA256 HOT 2
- Registering hook : Array to String Conversion error HOT 4
- Could someone please give me a good example code to authenticate the App for the first time using Context::initialize(), OAuth::begin() and etc HOT 2
- Authenticating App Proxy requests HOT 3
- A new release of the Shopify API is due soon HOT 2
- Maximum Request Limit Exceeds error. HOT 2
- Add support for Shopify API version 2024-01 HOT 2
- How do I upload a return label to a return enquiry? HOT 2
- Not support psr/http-message :^2.0 HOT 3
- PAckage abandoned? HOT 10
- A new release of the Shopify API is due soon HOT 2
- shopify REST Admin API Response header doesn't includes a URL("link") for the next page of results HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shopify-api-php.