Good morning or afternoon even good evening!
I have been trying to achieve the separating resource server from the auth server using OAuth Toolkit with Django and I got stuck.
Tryed:
First, I have already tried the following:
Follow the tutorial with this tutorial and it works when it comes to serving projects with python manage.py runserver.
The whole structure is that I use Postmen as client and request to resource server and check the authenticated user with auth server so there is introspection process between resource and auth server.
Isuss:
As I mentioned, the whole idea works only when I serve project with python manage.py runserver. When deployed projects in Docker-Compose using Nginx and Gunicorn to serve projects, headache has come.
This was the final error - Max retries exceeded with url: /o/introspect/
When I tracked back to the root - Introspection: Failed POST to localhost:8000/o/introspect/ in token lookup
This is error in the client app - "Authentication credentials were not provided."
I found this issue is happened when the access token is expired or revoked and the system try to get a new access token to resource server from auth server.
Somehow, the introspection process is failed by for me an unknown reason!
Anybody hit this wall before?
Edit: (Thu Mar 4, 2021)
I found another reason that can more related to the exact issue!
As the docker compose create services that each service serves one container consisting of image of the project(Django). Therefore, each project is isolated from each other!
This results in A project can be harder to request to B project as the port for B project cannot be reach in the A project.
A potential solution may be using the Nginx server proxy name (which is gonna be the same as the name of each service in docker compose) to make a request.
I am still trying to handle this! If anyone can help that would be really appreciate!
Edit: (Thu Mar 4, 2021 5:07PM Taiwan) Problem Sovled
Solution is demoed!