Skip to content

Instantly share code, notes, and snippets.

View WajahatAnwar's full-sized avatar

Wajahat Anwar WajahatAnwar

  • Ikarobar
  • Lahore, Pakistan
View GitHub Profile
@WajahatAnwar
WajahatAnwar / app-bridge-session-token
Last active May 27, 2021 14:12
Implementation of session tokens using App Bridge
import React, { useState } from "react"
import ApolloClient from "apollo-client";
import { AppProvider } from "@shopify/polaris"
import { usePage } from "@inertiajs/inertia-react"
import { Provider, Toast } from "@shopify/app-bridge-react"
import { authenticatedFetch, getSessionToken } from "@shopify/app-bridge-utils";
import deepMerge from "@shopify/app-bridge/actions/merge";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import { Base64 } from 'js-base64'; //For encoding & decoding to base64