question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

keycloak 11 & nest-keycloak-connect 1.3.0-alpha.3 - fail to get 200 with roles

See original GitHub issue

Hi,

I’m trying to make this project work with latest keycloak docker instance (currently version 11.x).

Using a fresh nestjs project with latest nest-keycloak-connect i’m using the following code :

@Controller()
@Resource('admin')
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get('admin')
  @Roles('admin')
  getHello(): string {
    return this.appService.getHello();
  }
}

I have setup a keycloak custom realm, with a scope “admin” and a role “admin” under it. Here is the decoded jwt I try to pass to the app :

{
  "exp": 1598143670,
  "iat": 1598143370,
  "jti": "f5b80827-0573-4710-a548-14ace94d1473",
  "iss": "http://localhost:8080/auth/realms/testproject",
  "sub": "e85763bd-281a-4fca-86a0-f7afcaaf46d2",
  "typ": "Bearer",
  "azp": "admin-cli",
  "session_state": "e7b4e27b-8cba-4124-9d41-c1659ceeec23",
  "acr": "1",
  "realm_access": {
    "roles": [
      "admin"
    ]
  },
  "scope": "email admin roles profile",
  "email_verified": true,
  "name": "admin",
  "preferred_username": "admin",
  "given_name": "admin",
  "family_name": "admin",
  "email": "admin@admin.com"
}

I also try to add @Scopes(‘admin’), without much more success.

Do I miss something ? Which version of keycloak is supported by this lib ?

Thanks for your help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ferrerojoshcommented, Aug 28, 2020

Tickets like this seems to be more rampant, I’ll soon be putting up a proper example project so people won’t get confused later on.

0reactions
ferrerojoshcommented, Nov 15, 2020

Any guesses when keycloak 11 support will be released?

I’ll check if there are any breaking changes, then I’ll do a release

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Notes - Keycloak
We are happy to announce that the new Keycloak Operator for the Quarkus based distribution is no longer a preview feature. We added...
Read more >
Server Administration Guide - Keycloak
Admin , user , manager , and employee are all typical roles that may exist in an organization. Applications often assign access and...
Read more >
Server Administration Guide - Keycloak
Token mappers - Map user attributes, roles, etc. how you want into tokens and statements. Not-before revocation policies per realm, application ...
Read more >
Upgrading Guide - Keycloak
This guide describes how to upgrade Keycloak. It is recommended that you start by upgrading the Keycloak server first and Keycloak adapters ...
Read more >
Keycloak 20.0.0 released
We are happy to announce that the new Keycloak Operator for the Quarkus based distribution is no longer a preview feature.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found