This module exposes decoders and helpers to fine tune some requests when necessary.
This might come in handy for provider that doesn't exactly implement the OAuth 2.0 RFC (like the API v3 of GitHub). With these utilities, one should hopefully be able to adjust requests made to the Authorization Server and cope with implementation quirks.
Alias for the behavior passed to some function in order to adjust Http Request before they get sent
For instance,
adjustRequest : AdjustRequest ResponseToken
adjustRequest req =
{ req | headers = [ Http.header "Accept" ("application/json") ] :: req.headers }Json decoder for a response. You may provide a custom response decoder using other decoders from this module, or some of your own craft.
For instance,
myScopeDecoder : Json.Decoder (Maybe (List String))
myScopeDecoder =
Json.maybe <|
Json.oneOf
[ Json.field "scope" (Json.map (String.split ",") Json.string) ]
myResponseDecoder : Json.Decoder ResponseToken
myResponseDecoder =
Json.map5 makeResponseToken
accessTokenDecoder
expiresInDecoder
refreshTokenDecoder
myScopeDecoder
stateDecoderJson decoder for an expire timestamp
Json decoder for a scope
Json decoder for a scope, allowing comma- or space-separated scopes
Json decoder for a state
Json decoder for an access token
Json decoder for a refresh token
Create a Token from a value and token type. Note that only bearer token are supported
Create a ResponseToken record from various parameters
Parts required to build a request. This record is given to
Http.requestin order to create a new request and may be adjusted at will.