Uncaught ScopeNotGrantedError: Using shipping address requires having shipping address permissions

Uncaught ScopeNotGrantedError: Using shipping address requires having shipping address permissions

akshatj
Shopify Partner
2 0 0

i am trying to access address1 on shopify information page using checkout extensiblity but somehow i am getting this error in console i have tried multiple ways by giving different permission to the app, need suggestions on how can i fix this error 
Steps Performed:

shopify.app.toml
-[access_scopes]
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
scopes = "read_shipping"

Commands used after adding access scopes
-npm run config:push
-npm run dev and updated the app 

same result after this. also added permissions for app dashboard.
Main checkout.jsx code

import {
Banner,
useApi,
useTranslate,
reactExtension,
useExtensionCapability,
useBuyerJourneyIntercept,
useShippingAddress, // Import useShippingAddress
} from '@shopify/ui-extensions-react/checkout';
import React, { useState } from "react";

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
const translate = useTranslate();
const { extension } = useApi();

// Use useShippingAddress to get the shipping address
console.log("checkkk");
const shippingAddress = useShippingAddress();
console.log(shippingAddress)

return (
<Banner status="critical" title="Phone/Address Validation">
{translate('welcome', {target: extension.target})}
</Banner>
);
}

 

Reply 1 (1)

atom117
New Member
9 0 0

Hi @akshatj 

I had the same error too, to resolve this problem you need to activate customer protected data access permissions in your app.

To do it go to Shopify partner dashboard > select your app > api access > protected customer data and choose access type you want. 

https://shopify.dev/docs/apps/store/data-protection/protected-customer-data#request-access-to-protec...

 

I hope that will help you.