Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating redirect examples to 2.0 to halt confusion #36

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions _posts/2016-07-26-permission-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ permalink: blog/permission-tutorial/

<img src="/images/posts/2016-07-22/bookmark.png" style="width: 450px; float: right; display: inline-block;">

_September 14: This post has been updated to use the Horizon 2.0 API._

In this tutorial, I'll demonstrate how to build a social bookmark manager with
Horizon and the [Vue.js][] frontend framework. You can build the entire
application without writing a single line of backend code. This tutorial also
covers some of the best practices for developing with Horizon.

<!--more-->

# First steps

If you're completely new to Horizon, you might want to peruse the
Expand All @@ -34,8 +38,6 @@ safe for a production application, but it's ideal for rapid prototyping. As you
will see later in this tutorial, I typically use Horizon with the `--dev` option
until I'm ready to start implementing and testing permissions.

<!--more-->

# Authentication

<img src="/images/posts/2016-07-22/auth-flow.png">
Expand Down Expand Up @@ -124,14 +126,14 @@ In the internal database for your Horizon application, all of your application's
When a user wants to log in, redirect them to the Horizon server endpoint that
initiates the authentication process for the given OAuth provider. You can get
the path by calling the `authEndpoint` method and specifying the desired
provider. You can assign the return value to the `window.location.pathname`
attribute to perform the redirect:
provider. You can pass the return value to `window.location.replace(endpoint)`
to perform the redirect:

```javascript
const horizon = Horizon();

horizon.authEndpoint("github").subscribe(endpoint =>
location.pathname = endpoint);
window.location.replace(endpoint);
```

Horizon sends the user to the GitHub website, which displays a prompt that that
Expand Down Expand Up @@ -189,7 +191,7 @@ link that allows them to logout.
methods: {
login(ev) {
horizon.authEndpoint("github").subscribe(endpoint =>
location.pathname = endpoint);
window.location.replace(endpoint);
},
logout(ev) {
Horizon.clearAuthTokens();
Expand Down Expand Up @@ -252,7 +254,7 @@ const app = new Vue{
methods: {
login(ev) {
horizon.authEndpoint("github").subscribe(endpoint =>
location.pathname = endpoint);
window.location.replace(endpoint);
},
logout(ev) {
Horizon.clearAuthTokens();
Expand Down
2 changes: 2 additions & 0 deletions _posts/2016-08-23-horizon-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ fixes. The release represents the first round of improvements that we've
implemented in collaboration with our user community since Horizon's launch in
May.

<!--more-->

# Aggregation queries

Query aggregation is the most significant new feature in version 2.0. The new
Expand Down