Hy, Thanks for your feedback.
We started from the sample as proof of concept, working with localhost we got the proof of concept working. (running a backend server locally)
but in the real scenario there is no software running on the users machine, just a browser, and the browser can make requests to the backend server using HTTP methods (GET,POST,PUT,…).
The application is run a java server and servers angular to interact with the user.
When the user wants to access data from milestone (trough our application) we need to authenticate that user against the IDP (Identity provider) from milestone using a Oaut2.0 Authorization Code Flow, the main goal is to get a Access token on our backend server so we can request data for that specific user.
the flow is as describe above.
The login url is created by the backend and executed by the browser of the user, but the users browse is redirected trough the IDP flow (that’s how an authorization code flow works) but at the end the the authorization code needs to be swapped to a access token by the backend.
I’ll try to clarify the end step a bit more.
When the login is complete the IDP should drop the user back off at its “original” location.
If this would be localhost, our web application, served by a server, can not intervene anymore.
so the user needs to be dropped off on a webpage that sends the authorization code to the backend, the backend can then request the IDP for an access token and stores the access token for that user so when the user requests data from milestone the server can do the call using the access token from that specific user.
The only part missing at the moment is when we set the redirect url on the intial request to the milestone IDP on something else than localhost, the milestone IDP returns an error page.
In any Identity Provider i know, when using the authorization code flow you have to whitelist the redirect url (in the AllowedRedirectUris), We just can find the location where to do that in milestone.
hope this clarifies things.
I’ll add the error from a milestone log file.
2024-02-09 10:42:56.929+01:00 [ 47] INFO - Invoking IdentityServer endpoint: Duende.IdentityServer.Endpoints.AuthorizeEndpoint for /connect/authorize
2024-02-09 10:42:56.958+01:00 [ 47] ERROR - Invalid redirect_uri: "https://apps-accpt.portofantwerpbruges.com/apica/security/login/success"
{"ClientId":"VmsClient", "ClientName":"VmsClient", "AllowedRedirectUris":["http:\/\/127.0.0.1"], "SubjectId":"anonymous", "RequestedScopes":"", "PromptMode":"", "Raw":{"response_type":"code","nonce":"acb04d5ea12747f58001818f245f1f89","state":"n-xMHv-wPoo_E3aFGUJjLeiUYNUi-mhDaTLojFU4WCo","code_challenge":"Ib1ebU1ZPbIwoLoPgFuM4OPV5oeRuoERHz7mIX9HGOI","code_challenge_method":"S256","client_id":"VmsClient","scope":"openid profile managementserver offline_access","redirect_uri":"https:\/\/apps-accpt.portofantwerpbruges.com\/apica\/api\/camera\/security\/login\/success","acr_values":"idp:19ec4460-a9e1-4b79-9561-e0b677107d49","culture":"nl-NL","prompt":"login"}}
2024-02-09 10:42:56.958+01:00 [ 47] ERROR - Request validation failed
2024-02-09 10:42:56.958+01:00 [ 47] INFO - {"ClientId":"VmsClient", "ClientName":"VmsClient", "AllowedRedirectUris":["http:\/\/127.0.0.1"], "SubjectId":"anonymous", "RequestedScopes":"", "PromptMode":"", "Raw":{"response_type":"code","nonce":"acb04d5ea12747f58001818f245f1f89","state":"n-xMHv-wPoo_E3aFGUJjLeiUYNUi-mhDaTLojFU4WCo","code_challenge":"Ib1ebU1ZPbIwoLoPgFuM4OPV5oeRuoERHz7mIX9HGOI","code_challenge_method":"S256","client_id":"VmsClient","scope":"openid profile managementserver offline_access","redirect_uri":"https:\/\/apps-accpt.portofantwerpbruges.com\/apica\/api\/camera\/security\/login\/success","acr_values":"idp:19ec4460-a9e1-4b79-9561-e0b677107d49","culture":"nl-NL","prompt":"login"}}
2024-02-09 10:42:56.958+01:00 [ 47] INFO - {"ClientId":"VmsClient", "ClientName":"VmsClient", "Endpoint":"Authorize", "Scopes":"", "Error":"invalid_request", "ErrorDescription":"Invalid redirect_uri", "Category":"Token", "Name":"Token Issued Failure", "EventType":"Failure", "Id":2001, "ActivityId":"8000b528-0001-e400-b63f-84710c7967bb", "TimeStamp":"2024-02-09T09:42:56Z", "ProcessId":5500, "LocalIpAddress":"172.24.2.110:443", "RemoteIpAddress":"172.25.212.88"}