title: What is the use of OAuth example in Polaris React App Bridge documentation?
body: <p>Reading documentation <a href="https://help.shopify.com/en/api/embedded-apps/app-bridge/oauth" rel="nofollow noreferrer">here</a> and the code snippet example. Is this meant to consistently check if the user is logged into the embedded app or used for the initial registration/login process?</p>
  
  <p>Also, if I'm already using the <code>AppProvider</code> component, is this even needed? I know <code>AppProvider</code> handles initialization, according to their documentation <a href="https://help.shopify.com/en/api/embedded-apps/app-bridge/initialization" rel="nofollow noreferrer">here</a>.</p>
  
  <p>Here's the example from their documentation:</p>
  
  <pre><code>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}&amp;scope=read_products,read_content&amp;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);
  }
  </code></pre>