Open naqashm opened 1 month ago
Integrating the new Shopify App Bridge version requires additional work since it does not work the same as AppBridge v3. It's not a matter of just changing the script URL but it would be nice if an update is published to support this new version ;-)
This looks like its going to start affecting existing apps.
It’s now an official requirement: Shopify App Store apps must support the latest App Bridge.
I’ve started implementing App Bridge v4 using this package. It appears that updates are needed in the token_handler.blade.php file to utilize shopify.idToken()
and in the VerifyShopify.php file to handle the id_token from the GET parameters. From my initial tests, App Bridge v4 seems to eliminate the need for the URL::tokenRoute()
function in blade files.
However, I’ll wait for an official implementation from the package to confirm, as I’m not fully confident that my current solution is production-ready.
As there is a year to implement this, I'd like to wait a little bit and see how this pans out for other app developers before committing to an approach in the main package.
I'll probably update my own apps first using overrides and seeing how that plays with it.
Shopify cannot approve the submitted app due to the use of the old appBridge version. I have tried many ways to solve the problem, but as we can see, we need to remove all appBridge definitions on all pages.
We use Livewire, so I applied all the code to token.blade.php
. The application works fine but not in the authentication process. We are trying to solve the problem because our 2 applications are in the review process.
@baristinaz87 I see, this is imposed for new apps right away?
If so, we might need to add a new config value to that other apps are backwards compatible for a little while.
@baristinaz87 I see, this is imposed for new apps right away?
If so, we might need to add a new config value to that other apps are backwards compatible for a little while.
Yes, we submitted our apps the previous week. They didn't accept both. If you want to submit a new app after march 27 you have to use new the app bridge version
Shopify didn't say anything for published apps or didn't give any plan to migration. But they may will want to do it in the future.
Using new app bridge is simple, but our framework is litle bit complex. We were successfully that app work on first page with new appbridge but token route process should change and redirection has to be removed Thus It will work properly. I can't say exact thing to solve, now trying to solve our app problems for pass the reviewing.
I was able to implement AppBridge v4 with this package successfully for an app but I'm doing some tests to see if it's stable enough.
In my implementation, I had to override a few files...
token_handler.blade.php by updating the retrieveToken() function :
window.sessionToken = await shopify.idToken();
token.blade.php for the redirect :
shopify.idToken().then((token) => {
window.location.href = `{!! $target !!}{!! Str::contains($target, '?') ? '&' : '?' !!}id_token=${token}{{ Str::contains($target, 'host')? '' : '&host=${host}'}}`;
});
VerifiyShopify.php, especially the function getAccessTokenFromRequest() :
return $request->get('token') ?? $request->get('id_token');
I stopped using URL::tokenRoute()
I’ll check if I updated any other files, as it was a lot of back-and-forth work.
Shopify now recommends to include the App Bridge script in below format:
<script src="https://cdn.shopify.com/shopifycloud/app-bridge.js"></script>
However, the current version of your package does not support this integration method. Could you please add support for an environment variable that allows us to specify the use of Shopify's Cloud CDN URL in layouts.default.blade.php? This would make it easier to follow Shopify's updated best practices. Thank you.