On Sunday, April 2, 2017 at 4:44:29 AM UTC+1, Richard Wood wrote:
>
> Hi All
>
> I'm working on a base application involving authentication, Auth0 and AWS 
> access. There's a lot of useful starter scripts and examples around - hats 
> off to the community - so I'm basically pulling stuff together for 
> server-less projects and so I can learn elm and authentication.
>
> I'd be keen for anyone to have a look and give me some feedback:
> Elm repository https://github.com/rwoodnz/elm-base
> AWS repository https://github.com/rwoodnz/aws-base
>
> *My question*
> On entry I pop up the Auth0 lock if the user has not got an existing 
> token. My next stage is to add a check or checks for Token expiry. I want 
> to do that in the code and not make a call to Auth0 or rely on a bad 
> response from the API.
>
> I've found the very useful-looking JWT library and the Time functionality 
> and am trying not to despair at the amount of code it may take!
>
> Is there a simpler way? Should I just port out to Javascript as it would 
> only be a little function there? I'm really trying to avoid that in 
> principle and so as to force my Elm learning.
>
> Richard
>

This might help you:
 
https://github.com/rupertlssmith/elm-auth/blob/master/src/AuthController.elm#L319

    Time.now
            |> andThen (\now -> Process.sleep <| delay refreshDate now)


Lets me put in a delay from now until I am ready to check or refresh the 
token. After the next |> andThen you can put the code to periodically check 
or whatever you want to do.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to