atomrc/cyclejs-auth0

Lock screen not appearing

Closed this issue ยท 3 comments

I have a test spike based on create-cycle-app and you example code. However I do not see lock, the DOM is rendered and there is nothing in local or session or storage. Also no obviously auth0 related network activity

Before I set localhost:8000 up in Auth0 CORS settings I was getting an error

Is there something silly I am not doing?

import {run} from '@cycle/xstream-run'
import {App} from './app'
import {makeDOMDriver} from '@cycle/dom';
import {createHistory} from "history";
import {makeRouterDriver} from 'cyclic-router'
import switchPath from 'switch-path'
import {makeAuth0Driver, protect} from "cyclejs-auth0";

//const main = App
function main(sources) {
    const ProtectedApp = protect(App); 
    const sinks = ProtectedApp(sources);

    return {
        DOM: sinks.DOM
      }
}

const drivers = {
  DOM: makeDOMDriver('#app'),
  auth0: makeAuth0Driver('sLMHjO3FM8Pj8v5AO9IWCaR0vejPYynY', 'odspike.eu.auth0.com'),
  router: makeRouterDriver(createHistory(), switchPath)
}

run(main, drivers)
import {div} from '@cycle/dom'
import xs from 'xstream'

export function App (sources) {
  const vtree$ = xs.of(
    div('My Awesome Cycle.js app')
  )
  const sinks = {
    DOM: vtree$
  }
  return sinks
}

I have the latest version of all components (not Cycle Unified though).

Any ideas would be most helpful

So that was a problem with the README. The example is not returning the auth0 sink in the main function (so nothing is sent to the driver ... and nothing happens of course).

To fix that, you need to replace those lines

function main(sources) {
    const ProtectedApp = protect(App); 
    const sinks = ProtectedApp(sources);

-    return {
-        DOM: sinks.DOM
-      }
+     return sinks
}

And everything should work as expected.

Sorry for the inconvenience

I've updated the doc, so thank you for pointing this out ๐Ÿ‘

How did I miss that! :)