-2

I am trying to build an app, with fastapi. I was trying to use keycloak for authentication part,

from fastapi_keycloak import FastAPIKeycloak, OIDCUser

app = FastAPI()
idp = FastAPIKeycloak(
    server_url="https://auth.some-domain.com/auth",
    client_id="some-client",
    client_secret="some-client-secret",
    admin_client_secret="admin-cli-secret",
    realm="some-realm-name",
    callback_uri="http://localhost:8081/callback"
)
idp.add_swagger_config(app)

I am using version 20.0 and someone recommended to not use http:// when providing server url.

I followed this process for integration https://fastapi-keycloak.code-specialist.com/#apppy as per this documentation. Now when I am giving my server url starting with http:// it shows throws an error, i.e. MissingSchema: Invalid URL 'None': No scheme supplied. Perhaps you meant http://None? and without http:// InvalidSchema(f"No connection adapters were found for {url!r}") requests.exceptions.InvalidSchema: No connection adapters were found for this is the result. Can someone please look into this and help me out. Thank you InvalidSchema(f"No connection adapters were found for {url!r}") requests.exceptions.InvalidSchema: No connection adapters were found for

1 Answers1

0

FastAPi not support v20.0, it supports v16.1.x(latest version v16.1.1) So you can't using with v20.0

I tested this docker compose and app.py

This is access roles API to FastAPI

http://localhost:8081/roles

enter image description here

Bench Vue
  • 5,257
  • 2
  • 10
  • 14