billstclair / elm-oauth-middleware / OAuthMiddleware.ResponseToken

This module revives the ResponseToken type.

ResponseToken and its decoders were removed from truqu/elm-oauth2 version 4.0.0. This module is a copy of the version 3.0.0 code.

Most user code will never use this module, except indirectly, via OAuthMiddleware.

Types


type alias ResponseToken =
{ expiresIn : Maybe Basics.Int
, refreshToken : Maybe OAuth.Token
, scope : List String
, state : Maybe String
, token : OAuth.Token 
}

The response obtained as a result of an authentication (implicit or not)

Json Decoders

responseTokenDecoder : Json.Decode.Decoder ResponseToken

Json decoder for a response.

stateDecoder : Json.Decode.Decoder (Maybe String)

Json decoder for a state

Constructors

makeToken : Maybe OAuth.TokenType -> Maybe OAuth.TokenString -> Maybe OAuth.Token

Create a token from two string representing a token type and an actual token value. This is intended to be used in Json decoders or Query parsers. Returns 'Nothing' when the token type is Nothing , different from Just "Bearer" or when there's no token at all.

Same as OAuth.makeToken, but allows "bearer" as well as "Bearer" for the TokenType.

makeResponseToken : OAuth.Token -> Maybe Basics.Int -> Maybe OAuth.Token -> List String -> Maybe String -> ResponseToken

Create a ResponseToken record from various parameters