Skip to content

Conversation

lcpojr
Copy link
Owner

@lcpojr lcpojr commented Sep 26, 2020

Now we also accepts client credentials flow on sign in endpoint.

@lcpojr lcpojr self-assigned this Sep 26, 2020
Comment on lines +91 to +98
defp validate_grant_flows(%{valid?: true, changes: %{grant_flows: flows}} = changeset) do
if Enum.all?(flows, &(&1 in @possible_grant_flows)) do
changeset
else
opts = [validation: :subset, enum: @possible_grant_flows]
add_error(changeset, :grant_flows, "is invalid", opts)
end
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is just to give a customized response?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah !
It's better to add the error as a changeset validation failure because that's the expected response.
This helps out a lot when we have a default controller fallback that know how to handle changeset errors.

Copy link
Contributor

@Nel-Medeiros Nel-Medeiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smells like chocolate.

@lcpojr lcpojr merged commit 5c64c5d into master Sep 27, 2020
@lcpojr lcpojr deleted the feat/client-credentials-endpoint branch September 27, 2020 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants