When is client_secret validated? #91
-
For confidential clients, when and where is the client_secret validated? Is this something that's supposed to be done in the get_client implementation of the storage class? In the case where the client_secret is wrong, is it correct to return "None" in the implementation of get_client? It seems like this isn't implemented in the example provided in https://github.com/aliev/aioauth-fastapi/blob/master/aioauth_fastapi_demo/oauth2/storage.py#L206, is that a bug or am I misunderstanding the intention? Thanks, Shawn |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
In some cases, In cases where it is required (for example, for the client_credentials grant type), this value will be presented. There is already a check for this in aioauth: https://github.com/aliev/aioauth/blob/master/aioauth/grant_type.py#L261. You are correct that the second case is not considered in Storage.get_client. Since this is a demo project, such issues can exist. |
Beta Was this translation helpful? Give feedback.
-
In the case of an authorization_code grant, it's optional in the general case, but if the client has a secret assigned to them, then it becomes required, right? And in that case, it should be passed to get_client and I should return None if it's not correct, is that right? I.e. in those cases where the secret is required, the correct thing to do for a wrong secret is to return None from get_client? |
Beta Was this translation helpful? Give feedback.
For an
authorization_code
grant, aclient_secret
is required sometimes: It's not ever required on the authorization request, but it IS required on the token request IF the client has a secret assigned to it (making it a "confidential client"). However it's not necessary to assign client secrets to your clients for them to be able to useauthorization_code
grants, and if they don't have a secret assigned then they don't need to provide one. But if they do have one assigned, then they MUST use it in e.g. the token request.See here: https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3