Skip to content

Commit d01eb94

Browse files
committed
Add more links to samples and such
1 parent 6185de8 commit d01eb94

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

content/guides/basics-of-authentication.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ In this section, we're going to focus on the basics of authentication. Specifica
1111
we're going to create a Ruby server (using [Sinatra][Sinatra]) that implements
1212
the [web flow][webflow] of an application in several different ways.
1313

14+
Note: you can download the complete source code for this project [from the platform-samples repo](https://github.com/github/platform-samples/tree/master/api/ruby/basics-of-authentication).
15+
1416
## Registering your app
1517

1618
First, you'll need to [register your
@@ -25,7 +27,7 @@ up your application. It's the callback URL that GitHub returns the user to after
2527
successful authentication.
2628

2729
Since we're running a regular Sinatra server, the location of the local instance
28-
is set to `http://localhost/:4567`. Let's fill in the callback URL as `http://localhost/:4567/callback`.
30+
is set to `http://localhost:4567`. Let's fill in the callback URL as `http://localhost:4567/callback`.
2931

3032
## Accepting user authorization
3133

@@ -62,16 +64,16 @@ Next, in _views/index.erb_, paste this content:
6264

6365
Obviously, you'll want to change `<your_client_id>` to match your actual Client ID.
6466

65-
Navigate your browser to `http://localhost/:4567`. After clicking on the link, you
67+
Navigate your browser to `http://localhost:4567`. After clicking on the link, you
6668
should be taken to GitHub, and presented with a dialog that looks something like this:
6769
![](/images/oauth_prompt.png)
6870

6971
If you trust yourself, click **Authorize App**. Wuh-oh! Sinatra spits out a
7072
`404` error. What gives?!
7173

7274
Well, remember when we specified a Callback URL to be `callback`? We didn't provide
73-
a route for it, so GitHub doesn't know where to drop the user after they authorize the app.
74-
Let's fix that now!
75+
a route for it, so GitHub doesn't know where to drop the user after they authorize
76+
the app. Let's fix that now!
7577

7678
### Providing a callback
7779

@@ -113,7 +115,7 @@ We can do whatever we want with our results. In this case, we'll just dump them
113115

114116
It'd be a pretty bad model if we required users to log into the app every single
115117
time they needed to access the web page. For example, try navigating directly to
116-
`http://localhost/:4567/basic`. You'll get an error.
118+
`http://localhost:4567/basic`. You'll get an error.
117119

118120
What if we could circumvent the entire
119121
"click here" process, and just _remember_ that, as log as the user's logged into
@@ -217,7 +219,7 @@ Next, create a file in _views_ called _advanced.erb_, and paste this markup into
217219

218220
From the command line, call `rackup -p 4567`, which starts up your
219221
Rack server on port `4567`--the same port we used when we had a simple Sinatra app.
220-
When you navigate to `http://localhost/:4567`, the app calls `authenticate!`--another
222+
When you navigate to `http://localhost:4567`, the app calls `authenticate!`--another
221223
internal `sinatra-auth-github` method--which redirects you to `/callback`. `/callback`
222224
then sends us back to `/`, and since we've been authenticated, renders _advanced.erb_.
223225

@@ -228,6 +230,9 @@ the same callback URL, we've got to do a little bit of wonkiness to make it work
228230
Also, if we had never authorized this Rack application to access our GitHub data,
229231
we would've seen the same confirmation dialog from earlier pop-up and warn us.
230232

233+
If you'd like, you can play around with [yet another Sinatra-GitHub auth example][sinatra auth github test]
234+
available as a seperate project.
235+
231236
[webflow]: http://developer.github.com/v3/oauth/#web-application-flow
232237
[Sinatra]: http://www.sinatrarb.com/
233238
[about env vars]: http://en.wikipedia.org/wiki/Environment_variable#Getting_and_setting_environment_variables
@@ -236,4 +241,5 @@ we would've seen the same confirmation dialog from earlier pop-up and warn us.
236241
[libraries]: http://developer.github.com/v3/libraries/
237242
[rack guide]: http://en.wikipedia.org/wiki/Rack_(web_server_interface)
238243
[sinatra auth github]: https://github.com/atmos/sinatra_auth_github
239-
[sinatra extension]: http://www.sinatrarb.com/extensions.html
244+
[sinatra extension]: http://www.sinatrarb.com/extensions.html
245+
[sinatra auth github test]: https://github.com/atmos/sinatra-auth-github-test

content/guides/rendering-data-as-graphs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ be using Octokit, a Ruby library designed to interact with the GitHub API.
1414
We're going to jump right in and assume you've already read the ["Basics of Authentication"][basics-of-authentication]
1515
guide.
1616

17+
Note: you can download the complete source code for this project [from the platform-samples repo](https://github.com/github/platform-samples/tree/master/api/ruby/rendering-data-as-graphs).
18+
1719
Go ahead and register an application through GitHub. Set the main URL and callback
1820
URL to `http://localhost:4567/`. As before, we're going to be implementing a Rack middleware
1921
using [sinatra-auth-github][sinatra auth github]:

0 commit comments

Comments
 (0)