using docker to test out fief, but fastapi fief client uses httpcore which doesn't like my self signed cert #346
-
my fastapi server runs fine on localhost with SSL using self signed certs, but when fief client goes to validate access token, i've tried every scenario that doesn't work. please help. File "/home/machine/py312/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File "/home/machine/py312/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/home/machine/py312/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/routing.py", line 758, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/routing.py", line 778, in app
await route.handle(scope, receive, send)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/routing.py", line 299, in handle
await self.app(scope, receive, send)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/routing.py", line 79, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/home/machine/py312/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/home/machine/py312/lib/python3.12/site-packages/starlette/routing.py", line 74, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/fastapi/routing.py", line 269, in app
solved_result = await solve_dependencies(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/fastapi/dependencies/utils.py", line 598, in solve_dependencies
solved = await call(**sub_values)
^^^^^^^^^^^^^^^^^^^^^^^^
File "<makefun-gen-0>", line 2, in _authenticated
File "/home/machine/py312/lib/python3.12/site-packages/fief_client/integrations/fastapi.py", line 179, in _authenticated
info = await result
^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/fief_client/client.py", line 1123, in validate_access_token
jwks = await self._get_jwks()
^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/fief_client/client.py", line 1328, in _get_jwks
await self._get_openid_configuration(), "jwks_uri"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/fief_client/client.py", line 1318, in _get_openid_configuration
response = await client.send(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpx/_client.py", line 1646, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpx/_client.py", line 1674, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpx/_client.py", line 1711, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpx/_client.py", line 1748, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpx/_transports/default.py", line 371, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
raise exc from None
File "/home/machine/py312/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request
response = await connection.handle_async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
raise exc
File "/home/machine/py312/lib/python3.12/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpcore/_async/connection.py", line 154, in _connect
stream = await stream.start_tls(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 78, in start_tls
raise exc
File "/home/machine/py312/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 69, in start_tls
ssl_stream = await anyio.streams.tls.TLSStream.wrap(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/machine/py312/lib/python3.12/site-packages/anyio/streams/tls.py", line 132, in wrap
await wrapper._call_sslobject_method(ssl_object.do_handshake)
File "/home/machine/py312/lib/python3.12/site-packages/anyio/streams/tls.py", line 140, in _call_sslobject_method
result = func(*args)
^^^^^^^^^^^
File "/usr/lib/python3.12/ssl.py", line 917, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1000) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hail, @amalizzio 👋 Welcome to Fief's kingdom! Our team will get back to you very soon to help. In the meantime, take a minute to star our repository ⭐️ Want to support us?Subscribe to one of our paid plan to help us continue our work and receive exclusive information and benefits! Starts at $5/month 🪙 Farewell! |
Beta Was this translation helpful? Give feedback.
-
You can tune this behavior by setting the It corresponds to the That said, I'm not sure you need to bother with SSL in local. You can run Fief in plain HTTP in local without any particular issue. |
Beta Was this translation helpful? Give feedback.
You can tune this behavior by setting the
verify
parameter on the client: https://fief-dev.github.io/fief-python/fief_client.html#Fief.__init__It corresponds to the
verify
parameter of HTTPX: https://www.python-httpx.org/advanced/ssl/ The easiest way being to just setverify=False
That said, I'm not sure you need to bother with SSL in local. You can run Fief in plain HTTP in local without any particular issue.