title: Why does Okta-React Login redirect to blank page when using Django?
body: <p>I am using Okta-React for authentication in my React project and when I run the React test server my login authenticates successfully and redirects to the account page. When I run the React build command and render the build files with Django, my login authenticates properly, but when it redirects back to my site I get a blank /implicit/callback page, no login token or user info, and the code &amp; state gets stuck in the URL. Does anyone know why this is only happening when using Django, and what I can do to resolve this issue?</p>
  <p>Here is my authConfig:</p>
  <pre><code>const config = {
    issuer: 'https://dev-#######.okta.com/oauth2/default',
    redirectUri: window.location.origin + '/implicit/callback',
    clientId: '#@#@#@#@#@#@#@#@#',
    pkce: true
  };
  
  export default config;
  </code></pre>
  <p>Here is my accountAuth</p>
  <pre><code>import React, { useState, useEffect } from 'react';
  import { useOktaAuth } from '@okta/okta-react';
  import '../scss/sass.scss';
  import &quot;../../node_modules/bootstrap/scss/bootstrap.scss&quot;;
  import 'react-bootstrap';
  
  const AccountAuth = () =&gt; {
    const { authState, authService } = useOktaAuth();
    const [userInfo, setUserInfo] = useState(null);
  
    useEffect(() =&gt; {
      if (!authState.isAuthenticated) {
        // When user isn't authenticated, forget any user info
        setUserInfo(null);
      } else {
        authService.getUser().then((info) =&gt; {
          setUserInfo(info);
        });
      }
    }, [authState, authService]); // Update if authState changes
  
    localStorage.setItem(&quot;username&quot;, userInfo &amp;&amp; userInfo.given_name)
  
    const login = async () =&gt; {
      // Redirect to '/account_page' after login
      localStorage.setItem(&quot;accountLink&quot;, &quot;/account_page&quot;)
      localStorage.setItem(&quot;loginPostingVisibilityStyle&quot;, { display: &quot;none&quot; })
      localStorage.setItem(&quot;postingVisibleStyle&quot;, { display: 'block' })
      authService.login('/auth_index');
    }
  
    const logout = async () =&gt; {
      // Redirect to '/' after logout
      localStorage.setItem(&quot;username&quot;, null)
      localStorage.setItem(&quot;accountLink&quot;, &quot;/auth_index&quot;)
      localStorage.setItem(&quot;loginPostingVisibilityStyle&quot;, { display: &quot;block&quot; })
      localStorage.setItem(&quot;postingVisibleStyle&quot;, { display: 'none' })
      authService.logout('/');
    }
  
    return authState.isAuthenticated ?
      &lt;button className=&quot;settings-index&quot; onClick={logout}&gt;Logout&lt;/button&gt; :
      &lt;button className=&quot;settings-index&quot; onClick={login}&gt;Login&lt;/button&gt;;
  
  
  };
  
  export default AccountAuth;
  </code></pre>
  <p>Here is an example of the URL when it's stuck</p>
  <pre><code>http://localhost:8000/implicit/callback?code=-mRoU2jTR5HAFJeNVo_PVZsIj8qXuB1-aioFUiZBlWo&amp;state=c9RXCvEgQ4okNgp7C7wPkI62ifzTakC0Ezwd8ffTEb29g5fNALj7aQ63fjFNGGhT
  </code></pre>