Shopify

What does access mode refer to in the Shopify OAuth flow?

Hello Shopify Friends,

Shopify is a great value platform not only for merchants but also for developers who want to publish their apps on Shopify App Store. For this, they need a Shopify API. Shopify API allows downloading shop inventory and data that is required by Shopify Apps to function.  Check out the latest Shopify editions with 100+ new products and updates.

In order to access Shopify API, you need the authorization of the app. Let’s learn more

Shopify OAuth Flow

In Shopify App Development using Laravel, we need an access token to make the app authorized to access Shopify resources. Shopify CLI provides OAuth Flow to make the app authenticate. OAuth Flow provides you with an access token that can be used with every Shopify API request.

You can visit the official tutorial of OAuth flow.

Shopify Access Modes

You can generate a Shopify access token to access Shopify resources. There are two types of access modes in Shopify to generate an access token.

  1. Online Access Mode
  2. Offline Access Mode

Let us know the difference between the two

Difference Between – Online Access Mode & Offline Access Mode

Online Access Mode Offline Access Mode
Online access must be specifically requested during the authorization stage of OAuth. Offline access is the default mode when nothing is specified.
Tokens with an online access mode are associated with an individual user on a store. Hence, the lifespan of the access token and the user’s web session is the same. Tokens with offline access mode are meant for long-term access to a store, where no user interaction is involved.
Online access modes are used when a user is interacting with an app through the web and when the user permission level matters. Offline access modes are used for background work or maintenance work.
The online access mode generates a temporary access token that expires after some time (approx. 24 hours). When the access token is expired, Shopify generates a 401 Unauthorized response code. The offline access mode generates a permanent access token that expires only when the app gets uninstalled.
Use Case:
  • Your app’s security requirements specify short-lived access to a store.
  • When the user needs to manually trigger some events that require access to Shopify API.
Use Case:
  • Your app’s security requirements specify long-lived access to a store.
  • When you need to access API without the brand admin’s manual intent.
Example:

Here, create an OAuth Token using shopify-php-api.

Here, true is suggested that it generates an online access token.

Example:

Here, create an OAuth Token using shopify-php-api.

Here, false is suggested that it generates an offline access token.

Final Words:

This was all about Shopify OAuth Flow and Access Modes. Share the article with your Shopify friends to help them get the required information about authenticating the Shopify App.

Hire Shopify Developer to get your custom app built and add additional functionality to your Shopify Store.

Happy Reading!

Click to rate this post!
[Total: 2 Average: 5]
Bharat Desai

Bharat Desai is a Co-Founder at MageComp. He is an Adobe Magento Certified Frontend Developer ? with having 8+ Years of experience and has developed 150+ Magento 2 Products with MageComp. He has an unquenchable thirst to learn new things. On off days you can find him playing the game of Chess ♟️ or Cricket ?.

Recent Posts

Improving Error Handling and Transition Management in Remix with useRouteError and useViewTransitionState

In modern web development, seamless navigation and state management are crucial for delivering a smooth…

6 days ago

Magento Open Source 2.4.8-Beta Release Notes

Magento Open Source 2.4.8 beta version released on October  8, 2024. The latest release of…

1 week ago

How to Create Catalog Price Rule in Magento 2 Programmatically?

Hello Magento Friends, Creating catalog price rules programmatically in Magento 2 can be a valuable…

1 week ago

Top 10 Tips to Hire Shopify Developers

As the world of eCommerce continues to thrive, Shopify has become one of the most…

2 weeks ago

Managing Browser Events and Navigation in Shopify Remix: useBeforeUnload, useHref, and useLocation Hooks

Shopify Remix is an innovative framework that provides a streamlined experience for building fast, dynamic,…

2 weeks ago

Ultimate Guide to Hiring a Top Shopify Development Agency

Building a successful eCommerce store requires expertise, and for many businesses, Shopify has become the…

2 weeks ago