App Bridge React and Session Tokens

MilesLawrence
Tourist
12 1 2

Hi there, after reading this article (https://www.shopify.com/partners/blog/embedded-apps) about using session tokens to make our app load faster and more reliably, we decided to implement this in a new embedded test app before we roll it out to our other apps. However, the tutorial (https://shopify.dev/tutorials/authenticate-your-app-using-session-tokens?itcat=partner_blog&itterm=e...) seems to be a little convoluted and I'm having a tough time following the instructions.

The app is a Node.js app created via the shopify-cli. As such, I am working with the autogenerated code in the _app.js file, which uses <Provider> from "@shopify/app-bridge-react" rather than the traditional createApp from "@shopify/app-bridge"

Given that the ApolloClient is declared here, how should I perform authenticatedFetch for the app here? I've tried declaring `const app = useAppBridge()` outside of the MyApp class, but it seems to be a React hook which only works inside a functional component.

I appreciate any advice that anybody can offer to help me proceed with this. Should I be rewriting the MyApp class into a functional component? Or anything else? Thank you in advanced.

MilesLawrence
Tourist
12 1 2

I'm also having quite a bit of trouble with the Backend changes section of the tutorial; is there any place I can find further guidance on what to do with that? I don't have much experience with these kinds of stuff just yet but I'm trying to learn and do what I can.

I've tried a number of things, like trying to change MyApp from a class-based component into a functional component, using app-bridge rather than app-bridge-react to be able to use createApp, among other things, but I don't feel like I've made much progress with this. So again, any help is greatly appreciated!

0 Likes

I am trying to implement the same! But still no luck. 

Were you able to figure out a way?

- Looking to Automate Support on FB Messenger? Install our Messenger Marketing & Support App
- Want to embed Instagram Stories on your store? Install our Instagram Stories & Highlights App
- Have more questions? Feel free to email me.
- My reply helped? Click Like to show me some love!
0 Likes
MilesLawrence
Tourist
12 1 2

Unfortunately, I haven't made much progress on this either. I've put this off in the meantime until I find time to try and get a thorough understanding of this, though I'm still hoping someone can give some clearer advice.

0 Likes
Louise_Elmose_H
Shopify Partner
69 2 7

Hi,

I am interested in an examle as well, i.e. for a frontend using 

@Shopify/app-bridge-react
and a backend using node.js
 
Thanks,
-Louise
0 Likes
amrooz
Tourist
4 0 0

same here... any progress?

0 Likes