Wednesday, 4 September 2013

Building an assessment app in two days -- 7th commit

After another long delay, the seventh commit is up. This is the last of the plumbing commits, and adds OAuth login.

The OAuth authentication is handled by handy-play-oauth, which is about the smallest possible OAuth library. It doesn't itself do user management or any of that. All it does is:

  1. Forward the request to the relevant authentication service (in this case, GitHub's OAuth URL)

  2. Extract the returned OAuth repsonse

  3. Use the authentication token to call the service's REST API to get the user's details

  4. Call whatever action you've configured

In this case, the action I've configured is InterstitialController.onAuth. It either logs you in (if you've already set up your account), or shows an "interstitial" confirmation page if you haven't.

The reason for the confirmation page is that you can attach multiple identities to your account. So before Assessory creates a new account for you, it asks you to confirm that's what you want to do -- in case what you really wanted to do was add the login to an existing account.

(The long delay was me having dinner and getting over a migraine, by the way. Plus staring for far too long at a stupidly trivial bug while my head ached.)

No comments: