Home > Backend Development > Golang > Keycloak with krakend giving error 403 after logging in correctly?

Keycloak with krakend giving error 403 after logging in correctly?

王林
Release: 2024-02-14 10:51:09
forward
1141 people have browsed it

正确登录后,带有 krakend 的 Keycloak 给出错误 403?

php editor Apple introduced that when you use Keycloak with krakend to log in correctly, you may sometimes encounter error 403. A 403 error usually means that the server rejected the request, which may be caused by insufficient permissions or blocked access. There are several ways to resolve this issue, including checking permission settings, confirming the validity of login credentials, checking network connections, etc. Through step-by-step troubleshooting, this problem can be effectively solved to ensure smooth access to the required resources.

Question content

Hi, I'm trying to authenticate using Keycloak and Krakend, I can send my request, log in, then when I try to access the resource (using Insomnia) I get:

403 Forbidden: No response body returned.

I don't know why this is happening, please help!

This is my Krakend.json configuration file:

82BC1186967c2a759b3162034d07be32

In Keycloak I created my realm, user with credentials (with admin rights) and client, I think this is correct because my login with access token works fine, after logging in I get 403.

This is the service I wrote in go:

func JSONHandler(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"ciao": "ciao"})
}

func Init() {
    router := gin.Default()
    router.Use(middlewares.CORS())
    router.GET("/api", JSONHandler)
    err := router.Run(":8080")
    if err != nil {
        log.Fatal("Oh no")
    }
}
Copy after login

Solution

Modify fields:

"$schema": "https://www.krakend.io/schema/v3.json"
Copy after login

to

"$schema": "https://www.krakend.io/schema/v2.4.3.json"
Copy after login

Solved my problem!

The above is the detailed content of Keycloak with krakend giving error 403 after logging in correctly?. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template