# Login Redirect Error

**URL:** <https://devforum.okta.com/t/login-redirect-error/18882>\
**Category:** Questions\
**Created:** [January 12, 2022, 1:13pm UTC](https://devforum.okta.com/t/login-redirect-error/18882 "2022-01-12T13:13:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fhb](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fhb](https://devforum.okta.com/u/fhb)\
**Post date:** [January 12, 2022, 1:13pm UTC](https://devforum.okta.com/t/login-redirect-error/18882/1 "2022-01-12T13:13:29Z")

</div>

Hello. I’m currently learning Okta auth, and I’m trying to use Okta on a simple Spring Boot App, but there are some nebulous details

Following are some of the cofigurations I’ve done so far:

application.properties:

```auto
okta.oauth2.issuer=${OktaUri}/oauth2/default
okta.oauth2.client-id=${clientId}
okta.oauth2.client-secret=${clientSecret}

```

Configuration Adapter:

```auto
@Configuration
class OktaOAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
            http.authorizeRequests()
                    .anyRequest().authenticated();
    }
}

```

And a simple endpoint:

```auto
...
@GetMapping(value = "/rewards")
public ResponseEntity<List<ResultDTO>> findAll(){
    return ResponseEntity.ok(resultService.findAll());
}

```

Lastly, my sign-in login conf on admin dashboard:  
 ![login_conf](https://global.discourse-cdn.com/oktadev/original/2X/1/17b3d07a44d9ed00451d424dc7d2608d213d3e07.png)

I’m running the server on [http://localhost:8082](http://localhost:8082), but there are two things that aren’t clear to me:

1. When I access `http://localhost:8082/oauth2/authorization/okta` I receive a bad request (400) response  

As you can see I have [http://localhost:8082](http://localhost:8082) in my sign-in settings, I’m missing something?

1. If I configure a redirect\_uri in the application.properties file (`okta.oauth2.redirect-uri=https://dev-8085748.okta.com`, for example) it doesn’t replaces the redirect uri, but adds, resulting in that response:  
 ![postman_response](https://global.discourse-cdn.com/oktadev/original/2X/0/0a88a5c316aa4714d5c816542671baaaeb5e507d.png)

Is that a bug, or there is a way to replace the redirect\_uri completely? How can I set where to redirect?

---

<div class="post-metadata">

**Author:** ![fhb](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fhb](https://devforum.okta.com/u/fhb)\
**Post date:** [January 12, 2022, 3:54pm UTC](https://devforum.okta.com/t/login-redirect-error/18882/2 "2022-01-12T15:54:15Z")

</div>

Ok, so it seems that allowing wildcards didnt work as I expected, adding `http://localhost:8082/login/oauth2/code/okta` solved my problem with the login.

But I still didnt find out how to deal with the redirect uri.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 12, 2022, 9:21pm UTC](https://devforum.okta.com/t/login-redirect-error/18882/3 "2022-01-12T21:21:09Z")

</div>

How are you adding new redirect\_uris to your application in Okta? Is the problem you refer to about how you are trying to add an additional redirect\_uri, or something else?

---

<div class="post-metadata">

**Author:** ![fhb](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fhb](https://devforum.okta.com/u/fhb)\
**Post date:** [January 13, 2022, 11:46am UTC](https://devforum.okta.com/t/login-redirect-error/18882/4 "2022-01-13T11:46:37Z")

</div>

By adding

```auto
okta.oauth2.redirect-uri=https://dev-8085748.okta.com

```

on application.properties

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 13, 2022, 5:11pm UTC](https://devforum.okta.com/t/login-redirect-error/18882/5 "2022-01-13T17:11:34Z")

</div>

the redirect-uri should be the callback route in your app, for example, [our sample applications](https://github.com/okta/samples-java-spring/blob/6e7c3005548e8a8ef77c5ea0d560f15b5392f48f/okta-hosted-login/src/main/resources/application.yml#L11) use the relative path “/authorization-code/callback”

---

<div class="post-metadata">

**Author:** ![fhb](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fhb](https://devforum.okta.com/u/fhb)\
**Post date:** [January 13, 2022, 7:35pm UTC](https://devforum.okta.com/t/login-redirect-error/18882/6 "2022-01-13T19:35:49Z")

</div>

gotcha, its not the complete path, thanks

---

<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 14, 2022, 7:35pm UTC](https://devforum.okta.com/t/login-redirect-error/18882/7 "2022-01-14T19:35:53Z")

</div>

Closed on January 14, 2022, 7:35pm UTC

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