Created
December 30, 2017 11:11
-
-
Save grrinchas/dcb348c8594a6ce13e022bb08494d2ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parseToken : Parser (Maybe Token -> a) a | |
parseToken = | |
custom "ACCESS_TOKEN" <| | |
\segment -> | |
case String.split "&" segment |> List.map (String.split "=") of | |
[ [ "access_token", accessToken ] | |
, [ "expires_in", expires ] | |
, [ "token_type", type_ ] | |
, [ "state", state ] | |
, [ "id_token", idToken ] ] -> | |
case String.toInt expires of | |
Ok int -> | |
Ok <| Just <| Auth0Token accessToken idToken type_ int | |
Err e -> | |
Err "Missing expires_in" | |
_ -> | |
Err "Not an access token" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment