kkpoon/elm-auth0-urlparser/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Auth0.UrlParser

UrlParser for Auth0 token callback

Recommend o use this library with [kkpoon/elm-auth0](https://github.com/kkpoon/elm-auth0).

type alias Auth0CallbackInfo =
{ accessToken : String
, idToken : Maybe String
, expiresIn : Int
, tokenType : String
, state : String
}

Callback parameters from Auth0

If no openid in scope parameters in authorize request, no idToken return

accessTokenUrlParser : Parser (Auth0CallbackInfo -> a) a

Create a token callback UrlParser

import UrlParser exposing (..)
import Auth0.UrlParser exposing (Auth0CallbackInfo, accessTokenUrlParser)


type Route
    = AccessTokenRoute Auth0CallbackInfo
    | SomeOtherRoute


route : Parser (Route -> a) a
route =
    oneOf
        [ map AccessTokenRoute accessTokenUrlParser
        , map SomeOtherRoute (s "others")
        ]