Authenticate your app using session tokens

7 0 1

Hi guys, i want to integrate shopify app bridge with session token. I have built a shopify app in laravel.  Can anyone please help me to implement this.

Shopify Staff
Shopify Staff
7 0 3

Hi @Tarun-web1,

What are some of the issues that you are running into? Unfortunately, we don't have an example solution using Laravel. If you haven't already, check out for a guide on how session tokens work.


Hi @rezaansyed 

I also find it hard to implement with Python / Django. The doc is just too hard to follow:

1. How can I get session token? with this line, const sessionToken = getSessionToken(app); ?

2. I tried to install my app with Test app on development store, just click my development store. After that, it redirects to my App URL. It renders a basic template with App Bridge (added with CDN). What it shows:

  1. it redirects to my app url: .
  2. It gives Uncaught ReferenceError: getSessionToken is not defined.
  3. After that, App bridge redirects to the relative embedded URL in the Shopify admin and stops here
  4. The embedded area is showing: 

    There’s no page at this address. Check the URL and try again, or use the search bar to find what you need.

I was trying to follow the steps Load skeletons and Create app bridge client from the tutorial

The base template with app bridge:



<!DOCTYPE html>
  <title>{% block title %}Shopify Application{% endblock %}</title>
  <!-- <link href="/static/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" /> -->
  <div id="header">
    <h1><a href="{% url "index" %}">Shopify Demo Application</a></h1>
    <p id="login-link">
      {% comment %}
      {% if current_shop %}
          <span class="note">current shop</span> <a href="https://{{ current_shop.domain }}" class="shop_name">{{ current_shop.domain }}</a> <span class="note">|</span>
          <a href="{% url "shopify_app_logout" %}">logout</a>
      {% endif %}
      {% endcomment %}
  <div id="container" class="clearfix">
    <!-- Flash error & notice-->
    {% if messages %}
      {% for message in messages %}
      <div{% if message.tags %} class="{{ message.tags }}-message"{% endif %}>{{ message }}</div>
      {% endfor %}
    {% endif %}
    <!-- begin div.main-->
    <div id="main">
      {% block content %}{% endblock %}
    <!-- end div.main -->
  <script src=""></script>
    var AppBridge = window['app-bridge'];
    var actions = window['app-bridge'].actions;
    var createApp = AppBridge.default;
    var app = createApp({
      apiKey: '{{ shopify_api_key }}',
      shopOrigin: '{{ shopname }}',
      // forceRedirect: false
    const sessionToken = getSessionToken(app);
    console.log('sessionToken = ' + sessionToken);




SPO - SEO App to research keywords & edit social link preview
BYOB - Build Your Own Bundles
Shopify Partner
124 14 49

Hi @sillycube 

In case you or anyone else is stuck on this, you need to import app-bridge-utils as well.

<script src=""></script>
const getSessionToken = window['app-bridge-utils'].getSessionToken;
let sessionToken = getSessionToken(app)
Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
New Member
1 0 0

Hi brother did figure it out please help iam stuck in same place as you ( iam developing the app with Laravel too  thank you