Posted: January 21, 2015 By: Comments: 3

Sammy.js oAuth and Login Tutorial

Create SammyJS apps step-by-step guide on how to set up Sign-In that connects to any OAuth without exposing credentials to the client,

What is OAuth?

OAuth is an open protocol to allow secure authorization in a simple and standard method from web, mobile, and desktop applications.

Sammy.OAuth2

Sammy.OAuth2 is a plugin for using OAuth 2.0 to authenticate users and access your application’s API.

Sammy.js is light both in size (<20kb) and footprint. Pull it into your already started applications.

To keep things simple , i indicate this as follows:

define the main ‘route’

 Login route

get the authorized user and set the access token

Those events will fire-up when set the access token

  • oauth.connected – Access token set and ready to use. Triggered when new access token acquired, of when application starts and already has access token.
  • oauth.disconnected – Access token reset. Triggered by loseAccessToken().
  • oauth.denied – Authorization attempt rejected.

 Logout route

 

2755 Total Views 3 Views Today

Post Categories

Framework, Website Development

  • Antonello

    Hi Hany, great tutorial!
    Thank you.

    is there only a small error in form action it should post to “#/oauth/login”

    • thanks, i will change it

      • Chris Rush

        You still didn’t change it by the way.