# Local to Test/QA server

**URL:** <https://devforum.okta.com/t/local-to-test-qa-server/3438>\
**Category:** Questions\
**Created:** [November 20, 2018, 8:12pm UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438 "2018-11-20T20:12:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecamilon](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@ecamilon](https://devforum.okta.com/u/ecamilon)\
**Post date:** [November 20, 2018, 8:12pm UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438/1 "2018-11-20T20:12:46Z")

</div>

Hello, we are currently doing some testing for integrating OKTA for our React.js application for a client and came across some issues similar to this one : [Local to Test/QA Server Application Testing](https://devforum.okta.com/t/local-to-test-qa-server-application-testing/1463). with the primary difference being the language, with ours being a React SPA. We pretty much followed the implicit flow for react as described here : [https://developer.okta.com/code/react/okta\_react](https://developer.okta.com/code/react/okta_react).

It would run perfectly when running it on localhost serving it through npm start or building it and deploy to server with localhost configurations, however - when we build using the domain name such as [http://vmtest.company.com:8551](http://vmtest.company.com:8551) instead of [http://localhost:8551](http://localhost:8551) it wouldn’t resolve the callback coming after you log in. We’re able to log in but when it redirects we get a 404 error as well; see attached image.

 ![01%20PM](https://global.discourse-cdn.com/oktadev/original/1X/5be3906343389f9eee86d585a1f714f72b3572e3.png)

---

<div class="post-metadata">

**Author:** ![ecamilon](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@ecamilon](https://devforum.okta.com/u/ecamilon)\
**Post date:** [November 24, 2018, 12:01am UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438/2 "2018-11-24T00:01:57Z")

</div>

Can anybody help on this issue? I can upload the codebase if needed. Thanks.

---

<div class="post-metadata">

**Author:** ![lnhh](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lnhh](https://devforum.okta.com/u/lnhh)\
**Post date:** [January 8, 2019, 2:46pm UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438/3 "2019-01-08T14:46:54Z")

</div>

I have a very similar issue trying to build the login for an angular app.  
It works fine for localhost, but as soon as I change the hardcoded values to my domain and deploy it on my server, it just redirects to [mydomain.com/implicit/callback](http://mydomain.com/implicit/callback) and displays a 404.

The values I exchange are as follows:

const oktaConfigDev = {  
issuer: ‘[https://dev-XXXX.oktapreview.com/oauth2/default](https://dev-XXXX.oktapreview.com/oauth2/default)’,  
redirectUri: ‘[http://localhost:4200/implicit/callback](http://localhost:4200/implicit/callback)’,  
clientId: ‘XXXX’  
};

const oktaConfigProd = {  
issuer: ‘[https://dev-XXXX.oktapreview.com/oauth2/default](https://dev-XXXX.oktapreview.com/oauth2/default)’,  
redirectUri: ‘[https://mydomain.com/implicit/callback](https://mydomain.com/implicit/callback)’,  
clientId: ‘XXXX’  
};

My Routing:  
{path: ‘’, redirectTo: ‘/’, pathMatch: ‘full’},  
{path: ‘implicit/callback’, component: OktaCallbackComponent},  
{path: ‘404’, component: PagenotfoundComponent},  
{path: ‘\*\*’, redirectTo: ‘/404’, pathMatch: ‘full’},

and I login via my component and a button calling login():

constructor(public oktaAuth: OktaAuthService) {  
// Subscribe to authentication state changes  
this.oktaAuth.$authenticationState.subscribe(  
(isAuthenticated: boolean) =\> this.setUp(isAuthenticated)  
);  
}

ngOnInit() {  
this.oktaAuth.isAuthenticated()  
.then((isAuthenticated: boolean) =\> this.setUp(isAuthenticated))  
.catch(err =\> console.log('Error getting user authentication state ’ + err));  
}

login() {  
this.oktaAuth.loginRedirect(’/’);  
}

Maybe someone can help us.

---

<div class="post-metadata">

**Author:** ![laserdinosaur67](https://avatars.discourse-cdn.com/v4/letter/l/a88e4f/32.png) [@laserdinosaur67](https://devforum.okta.com/u/laserdinosaur67)\
**Post date:** [January 8, 2019, 9:31pm UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438/4 "2019-01-08T21:31:57Z")

</div>

Are you sure your account settings are not still set to your local callback urls? The setting is under “Applications \> Your app \> General \> Login redirect URIs”. If you have different callback urls for different environments, you will need a separate application setup for each.

Also, if you have a custom authorization server, make sure you have the CORS redirect setup. It’s under “API \> Trusted Origins \> Add Origin”.

---

<div class="post-metadata">

**Author:** ![lnhh](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lnhh](https://devforum.okta.com/u/lnhh)\
**Post date:** [January 9, 2019, 6:10am UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438/5 "2019-01-09T06:10:08Z")

</div>

I have added both. Localhost as well as [mydomain.com](http://mydomain.com).

How would my app work on multiple envs otherwise? Or would I need two okta apps then?

---

<div class="post-metadata">

**Author:** ![lnhh](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lnhh](https://devforum.okta.com/u/lnhh)\
**Post date:** [January 9, 2019, 8:22am UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438/6 "2019-01-09T08:22:27Z")

</div>

okay, ive tried that, also didnt work 😕

---

<div class="post-metadata">

**Author:** ![lnhh](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lnhh](https://devforum.okta.com/u/lnhh)\
**Post date:** [January 9, 2019, 12:43pm UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438/7 "2019-01-09T12:43:47Z")

</div>

fyi, ive done it exactly like this post: [https://developer.okta.com/quickstart/#/angular/nodejs/express](https://developer.okta.com/quickstart/#/angular/nodejs/express)

edito: ok, wow. I am an idiot. One has to include the subdomain in the cors entry…  
Now everything works as expected 🙂

thanks for the help!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 17, 2024, 7:28pm UTC](https://devforum.okta.com/t/local-to-test-qa-server/3438/8 "2024-01-17T19:28:28Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
