Please help! Code is expired!

After registration I have field “code” in redirect url but I can’t use it because it is expired although I have just created new user! Sprint is ending and I can’t finish the task, please help. I use angular.

`

`**

import { Component, OnInit } from ‘@angular/core’;
import {ActivatedRoute, Router} from “@angular/router”;
import {CookieService} from “ngx-cookie-service”;
import {compareNumbers} from “@angular/compiler-cli/src/version_helpers”;
import {HttpClient, HttpHeaders} from “@angular/common/http”;
import {Token} from “…/…/domain/token”;
import {TokenServiceService} from “…/…/services/token-service/token-service.service”;

@Component({
selector: ‘app-registration-success’,
templateUrl: ‘./registration-success.component.html’,
styleUrls: [‘./registration-success.component.scss’]
})

export class RegistrationSuccessComponent implements OnInit {

URL!: any;
urlParams!: any;
error!: any;

constructor(private http: HttpClient) {
this.URL = window.location.href;
console.log(this.URL.substring(99, this.URL.length));
this.getToken();
}

getToken() {
let body = new URLSearchParams();
body.set(‘grant_type’, “authorization_code”);
body.set(‘client_id’, “account-console”);
body.set(‘code’, this.URL.substring(99, this.URL.length));
body.set(‘redirect_uri’, “http://localhost:4200/registration-success”);

let options = {
headers: new HttpHeaders().set(‘Content-Type’, ‘application/x-www-form-urlencoded’)
};

this.http
.post(‘http://localhost:8080/realms/shop/protocol/openid-connect/token’, body.toString(), options)
.subscribe((result) => {
TokenServiceService.token = result;
}, (error) => {
this.error = error.message
console.log(error)
}, () => {
TokenServiceService.loadRefreshTokenTimer();
console.log(TokenServiceService.token)
});
}

ngOnInit(): void {

}

ngDoCheck(): void {

}

}

**`

How can I configure Keycloak to avoid this?