Getting error on login

I am having error when i do login. after login website should redirect to a admin page but it shows this below error.

AuthSdkError: Unable to parse a token from the url

please help me asap

What’s the response to the /authorize request being made by your application? Also, what version of our SDK (and which one) are you using?

the response is some data fetching from the mongodb database.

versions
image


//login form
import { useOktaAuth } from ‘@okta/okta-react’;
import { FormWrapper, LoginForm } from ‘…/…/components’;
import { showNotification } from ‘@pm/pm-ui’;
import ‘./adminLogin.css’;

function AdminLogin() {
const { oktaAuth, authState } = useOktaAuth();

//login hander
const loginHandler = (password, email) =>
oktaAuth
.signInWithCredentials({ password: password, username: email })
.then((res) => {
const { status, sessionToken } = res;
if (status === ‘SUCCESS’) {
if (!sessionToken) {
console.error(‘authentication process failed’);
}
oktaAuth.signInWithRedirect({
originalUri: ‘/’,
sessionToken,
});
}
})
.catch((err) => showNotification(‘error’, ‘email or password incorrect’));

if (!authState) {
return

Loading…
;
}
if (!authState.isAuthenticated) {
return (



);
}
}

export default AdminLogin;


//secure-route file
import React from ‘react’;
import { Route, Switch } from ‘react-router-dom’;
import { OktaAuth, toRelativeUrl } from ‘@okta/okta-auth-js’;
import { PATHS } from ‘…/constants’;
import { AppSkeleton } from ‘…/components’;
import {
AdminPanel,
} from ‘…/pages’;

function AdminSecureRoutes() {
return (



{/* */}


);
}

export default AdminSecureRoutes;


//routes file
import React from ‘react’;
import { Switch, Route, useHistory } from ‘react-router-dom’;
import { LoginCallback, SecureRoute } from ‘@okta/okta-react’;
import { Security } from ‘@okta/okta-react’;
import { OktaAuth, toRelativeUrl } from ‘@okta/okta-auth-js’;

import { PATHS } from ‘…/constants’;
import AdminSecureRoutes from ‘./AdminSecureRoutes’;
import { AdminLogin, AdminPanel } from ‘…/pages’;

const oktaAuth = new OktaAuth({
issuer: ‘https://dev-42684472.okta.com/oauth2/default’,
clientId: ‘0oa6g3qn4g4KobYzB5d7’,
redirectUri: window.location.origin + ‘/login/callback’,
});

function AdminRoutes() {

const history = useHistory();
const restoreOriginalUri = (_oktaAuth, originalUri) => {
history.replace(toRelativeUrl(originalUri || ‘/’, window.location.origin));
};

function customAuthHandler() {
history.push(‘/admin-login’);
}

console.log(AdminPanel);
return (







);
}

export default AdminRoutes;


//App.js file

import { Security } from ‘@okta/okta-react’;
import { OktaAuth, toRelativeUrl } from ‘@okta/okta-auth-js’;
import { BrowserRouter, useHistory } from ‘react-router-dom’;
import AdminRoutes from ‘…/adminRoutes’;

const App = () => {
return (



);
};

export default App;

I am using nx monorepo in which I am managing 3 apps. pm-user, pm-admin, and pm-backend.
and pm-user okta athentication + authrization working fine but in pm-admin it is giving error which is “AuthSdkError: Unable to parse a token from the url”