My App is using HashRouters now I want to integrate OKTA Authentication but that issue is Okta does not allow to add # in the redirection URL. As a result after successful login, I am landing on a 404 unknown pages. I don’t want to use change to Browser routers
Could anybody suggest to me how to deal with #Routes with OKta redirection…?
If possible can you please provide an example?
Cale
April 12, 2021, 2:12pm
2
Hi there. Take a look at our React sample app for an example of how we implement react router - here is a link specifically to the routing code:
/*
* Copyright (c) 2018, Okta, Inc. and/or its affiliates. All rights reserved.
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
*
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and limitations under the License.
*/
import React from 'react';
import { Route, useHistory, Switch } from 'react-router-dom';
import { OktaAuth } from '@okta/okta-auth-js';
import { Security, SecureRoute, LoginCallback } from '@okta/okta-react';
import { Container } from 'semantic-ui-react';
import config from './config';
import Home from './Home';
import CustomLoginComponent from './Login';
This file has been truncated. show original
I hope that helps!
You cannot use # in a redirect URL because of OAuth, not Okta. See RFC 6749 - The OAuth 2.0 Authorization Framework .
The endpoint URI MUST NOT include a fragment component
system
Closed
February 6, 2024, 11:27pm
4
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.