Support grant types other than "authorization_code" #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a replacement of #52 because that PR was based off our
master
branch and extra changes piled up on top of intended ones.I think this is another thing that we might want to clean up before pushing 1.0 to hex.pm.
This PR:
Removes the hardcoded "authorization_code" grant type from
fetch_tokens/2
.Before you could override the
grant_type
using params but because the code assumed this grant type by default it always addedredirect_uri
to the params too, which can not be removed.There are two reasons to remove it:
redirect_uri
is retrieved in a Phoenix controller, but if you want to use arefresh_token
grant in a background job you don't know thatredirect_uri
beforehand unless you have access to phoenix endpoint (which is not true for umbrella apps), and storing it doesn't make a lot of sense just to work around this function limitations;Additionally, I completely removed
redirect_uri
from the config map and made it a function argument forauthorization_uri/3
.Again, this is because it's the only required argument there, which should not be hidden behind a map, and it doesn't make a ton of sense to store this URI in the memory or database. Especially when the route can be changed and then you will have to migrate the data.