Gizra / elm-restful

Elm utilities useful for working with a RESTful backend (especially Drupal)
MIT License
3 stars 0 forks source link

Provide lower level for fetching the access token #8

Closed amitaibu closed 6 years ago

amitaibu commented 6 years ago

Currently we have https://github.com/Gizra/elm-restful/blob/d27432054b325fd9792db668b4cf74f1059c7988/src/Restful/Login.elm#L643-L647

I have a user case where I need to pass also queryParams (e.g. ?site=100).

I think we can either provide a function that will get also a List (String, String) (simpler); or a function that will allow chaining more commands to the HttpBuilder -- but I suspect that the first simpler approach would already cover most of our cases.

rgrempel commented 6 years ago

That seems sensible.

The other way you sometimes see this sort of thing handled is by appending a "domain" to the username supplied by the user. So, for instance, if the user supplies "rgrempel" as the username, you'd actually send "rgrempel@100" to the backend. Of course, that would require the backend to parse the username rather than looking at the query params etc., so one might or might not prefer that.

In any event, we may as well allow for query params.

rgrempel commented 6 years ago

BTW, I'm assuming that you need the ?site=100 only when trying to login with a username and password -- not when checking a cached access token. Let me know if that's not correct.

amitaibu commented 6 years ago

Yes, that's the case - only upon login with user/ pass

rgrempel commented 6 years ago

Merged in #12.