Hi, Mark!

For the first one, you can use |> App.WithInitMessage SetupAuth when setting up your app, if you want a message triggered after initialization.

Then in handling it, you need to make use of the dispatch function made available to you by CommandAsync if you want to react to setup being finished:

    | SetupAuth ->
        CommandAsync (fun dispatch ->
            async {
                do! Authentication.setup "myDomain" "myClientId"
                dispatch SetupAuthFinished

And similarly tie up other states. CommandAsync allows you to run some asynchronous computation then dispatch a message (or dispatch multiple ones while it is running), I think this would cover all your scenarios.

Hope this helps! András

By on 7/7/2019 5:09 AM ()

Hi Andras, so that works, but I'm hitting other problems with the wrapped JS library from Auth0 (requests being cancelled and I cannot figure out why, while if I use the library in a pure JS sample app, it works just fine).

So I'm trying to switch away from using that JS library at all, and doing the whole OAuth flow myself in F#.

Is there any documentation for that in the context of an SPA? I saw the WebSharper.OAuth blog post, but that involves the server. For my purposes, I need to do this completely client-side (there won't be any server in this my hobby project).

Cheers and thanks, Mark

By on 7/14/2019 8:09 AM ()

Hi András,

thanks and sorry for my late reaction, I don't typically get to work on this during the week.

Will try that out on the weekend - thank your for the help!

Cheers, Mark

By on 7/10/2019 11:12 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper