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.

Object non evaluated on getting decoded_token from Keycloak

See original GitHub issue

How to reproduce ?

Env preparation.

pipenv install fastapi fastapi-keycloak

I followed your quickstart and full example instructions then :

pipenv run python main.py

What the result?

pipenv run python main.py 
Traceback (most recent call last):
  File "main.py", line 10, in <module>
    idp = FastAPIKeycloak(
  File "/home/germainlef/.local/share/virtualenvs/auth-keycloak-WIW7vmvr/lib/python3.8/site-packages/fastapi_keycloak/api.py", line 125, in __init__
    self._get_admin_token()  # Requests an admin access token on startup
  File "/home/germainlef/.local/share/virtualenvs/auth-keycloak-WIW7vmvr/lib/python3.8/site-packages/fastapi_keycloak/api.py", line 285, in _get_admin_token
    self.admin_token = response.json()['access_token']
  File "/home/germainlef/.local/share/virtualenvs/auth-keycloak-WIW7vmvr/lib/python3.8/site-packages/fastapi_keycloak/api.py", line 154, in admin_token
    if not decoded_token.get('resource_access').get('realm-management') or not decoded_token.get('resource_access').get('account'):
AttributeError: 'NoneType' object has no attribute 'get'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
germainlefebvre4commented, Jan 4, 2022

Okey!!! I missed something… my bad

Service Accounts Roles was added to test-client instead of admin-cli.

0reactions
germainlefebvre4commented, May 28, 2022

Absolutly!

I have scripted this part to avoid hands mistakes

Read more comments on GitHub >

github_iconTop Results From Across the Web

mapping OAuth2 claims with roles to secure Resource Server ...
I have tested both solutions using Spring Boot 2.1.9.RELEASE, Spring Security 5.2.0.RELEASE and an official Keycloak 7.0.0 Docker image.
Read more >
Authorization Services Guide - Keycloak
A permission associates the object being protected with the policies that must be evaluated to determine whether access is granted.
Read more >
Open ID: connecting Keycloak and RabbitMQ [Part 2] - Codetain
Our proxy is running at keycloak-proxy:3000 address. ... We need body-parser package to get the content of request received from message ...
Read more >
scryptmouse/keycloak_rack: Rack middleware for ... - GitHub
Rack middleware for validating authorization tokens from Keycloak - GitHub ... If true, authentication will not provided a decoded token instance, true.
Read more >
Use AWS Lambda authorizers with a third-party identity ...
In order to use these non-AWS tokens to control access to ... The Lambda authorizer is invoked with the following object as the...
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