Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<div id="app">
<div v-if="userId">
<p>You are logged in! Your user ID is: {{userId}}</p>
<p>Click <a @click="logout">here</a> to logout</p>
<div v-if="!userId">
<p>I don't know you. You should <a @click="login">login</a>.</p>
const horizon = Horizon();
let app = new Vue({
el: "#app",
data: {userId: null},
ready() {
if (horizon.hasAuthToken())
horizon.currentUser().fetch().subscribe(user => this.userId =;
methods: {
login(ev) {
horizon.authEndpoint("github").subscribe(endpoint =>
logout(ev) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment