Closed Robin-Bonnin closed 3 years ago
Hi, the issue is that you do not have any keys for your IdP. I am not sure if OneLogin publishes the keys or not. But if yes, then you need to add jwks_uri
to your instance of ProviderConfigurationResponse
and the code should be able to get the keys itself. Otherwise, you might need to manually create a KeyStore and pass it to the Client
.
I am not sure what is actually the question in your side question. Could you please elaborate?
Thank you very much for your answer, it does work now.
I have updated my first post to reflect the change and add the full code. I could have searched for a while without finding the hint. :+1:
Regarding the side question, the more I think about it the more I feel it is a dumb question, but here it is.
You can see that I added in the first post my 2 endpoints. In each endpoint I am instantiating the Client
and ProviderConfigurationResponse
class.
What I saw in all the code snippets I saw was that the session was used to retrieve the client, hence it was not re instantiated.
So my question is, is it a best practice to re instantiate the client or not? But I think I answered myself by working with REST, you do not want to keep info between calls, so you have to.
Thank you anyway for your help!
Glad to hear it works now :)
It probably depends on the workflow, but in your case a new instance probably makes more sense.
Hi,
I am currently trying to implement pyoidc with OneLogin. Everything was going fine until I reach the
do_access_token_request()
function. An error is reached, and I can not figure out the reason, whether it is the config or the code.I have a very basic example to illustrate my meaning. I am using Django alongside DRF.
This is the function which handles the redirection from my IdP (OneLogin).
Endpoint which handles the Authorization request
Redirection endpoint handling access token retrieval and get user information
I just tried this snippet to handle the access token request, and when calling the function, it fails at veryfing the id token which is correctly received with the intended values.
I understand that my config is probably wrong but I cannot figure out the reason.
Side question: As we are using REST apis. Is it a good practice to instanciate the client at every API call. I did not find another way to do so, but all the examples I find seem to be using sessions.
Thank you for your help! Regards Robin Bonnin