GithubHelp home page GithubHelp logo

Comments (25)

daniel-sellarix avatar daniel-sellarix commented on August 15, 2024 4

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.

defive avatar defive commented on August 15, 2024 1

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.

rafaelstz avatar rafaelstz commented on August 15, 2024 1

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.

prashantpdwivedi avatar prashantpdwivedi commented on August 15, 2024

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.

raymundErank avatar raymundErank commented on August 15, 2024

@pvkhanh1708 how did you get that $cookies variable?

from shopify-api-php.

dj3plles avatar dj3plles commented on August 15, 2024

@pvkhanh1708 Where you able to resolve this issue? I'm currently having the same issue.

from shopify-api-php.

pvkhanh1708 avatar pvkhanh1708 commented on August 15, 2024

I am not passing this step, so I decided to use another package

from shopify-api-php.

tuyutian avatar tuyutian commented on August 15, 2024

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?
image

from shopify-api-php.

sachincr7 avatar sachincr7 commented on August 15, 2024

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.

image

from shopify-api-php.

badandboy avatar badandboy commented on August 15, 2024

i have the same question, do you resolve it ?

from shopify-api-php.

badandboy avatar badandboy commented on August 15, 2024

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.

image

set setCookieFunction = null, it work for me

from shopify-api-php.

vaimeo avatar vaimeo commented on August 15, 2024

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.

bakura10 avatar bakura10 commented on August 15, 2024

Same issue here. Has anybody found any way to solve this?

from shopify-api-php.

kevin-ryser avatar kevin-ryser commented on August 15, 2024

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.

fjarrett avatar fjarrett commented on August 15, 2024

I am getting these errors randomly as well, quite difficult to debug.

from shopify-api-php.

rafaelstz avatar rafaelstz commented on August 15, 2024

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.

shahbaz-mehar avatar shahbaz-mehar commented on August 15, 2024

Any update on it?

from shopify-api-php.

ketanm24 avatar ketanm24 commented on August 15, 2024

Do we have any solution to this issue?

from shopify-api-php.

vaimeo avatar vaimeo commented on August 15, 2024

Use offline session

from shopify-api-php.

ketanm24 avatar ketanm24 commented on August 15, 2024

I am facing this issue when I add additional scopes to the app.

from shopify-api-php.

vaimeo avatar vaimeo commented on August 15, 2024

I am facing this issue when I add additional scopes to the app.

reinstall the app

from shopify-api-php.

rafaelstz avatar rafaelstz commented on August 15, 2024

Try to use another API version, try to use 01-2023. It seems to be related to the Oauth compatibilities.

from shopify-api-php.

github-actions avatar github-actions commented on August 15, 2024

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.

github-actions avatar github-actions commented on August 15, 2024

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.

github-actions avatar github-actions commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.