在此处阅读文档和代码片段示例。这是否意味着持续检查用户是否登录到嵌入式应用程序或用于初始注册/登录过程?
另外,如果我已经在使用该AppProvider
组件,是否还需要这个?AppProvider
根据他们的文档here ,我知道处理初始化。
这是他们文档中的示例:
import createApp from '@shopify/app-bridge';
import {Redirect} from '@shopify/app-bridge/actions';
const apiKey = 'API key from Shopify Partner Dashboard';
const redirectUri = 'whitelisted redirect URI from Shopify Partner Dashboard';
const permissionUrl = `/oauth/authorize?client_id=${apiKey}&scope=read_products,read_content&redirect_uri=${redirectUri}`;
// If the current window is the 'parent', change the URL by setting location.href
if (window.top == window.self) {
window.location.assign(`https://${shopOrigin}/admin/${permissionUrl}`)
// If the current window is the 'child', change the parent's URL with Shopify App Bridge's Redirect action
} else {
const app = createApp({
apiKey: apiKey,
shopOrigin: shopOrigin,
});
Redirect.create(app).dispatch(Redirect.Action.ADMIN_PATH, permissionUrl);
}