Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

satellizer

> 编程语言
Open source

Token-based AngularJS Authentication

7.8K stars0 likes1 views
WebsiteGitHub

About

Token-based AngularJS Authentication

Satellizer

Live Demo


Satellizer is a simple to use, end-to-end, token-based authentication module for AngularJS with built-in support for Google, Facebook, LinkedIn, Twitter, Instagram, GitHub, Bitbucket, Yahoo, Twitch, Microsoft (Windows Live) OAuth providers, as well as Email and Password sign-in. However, you are not limited to the sign-in options above, in fact you can add any OAuth 1.0 or OAuth 2.0 provider by passing provider-specific information in the app config block.

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Table of Contents

  • Installation
  • Requirements for Mobile Apps
  • Usage
  • Configuration
  • Browser Support
  • Authentication Flow
  • Login with Email and Password
  • Login with OAuth 1.0
  • Login with OAuth 2.0
  • Logout
  • Obtaining OAuth Keys
  • API Reference
  • FAQ
  • Community Resources
  • Backers
  • Sponsors
  • Credits
  • License

Installation

Browser

xml
<script src="angular.js"></script>
<script src="satellizer.js"></script>
xml

<script src="https://cdn.jsdelivr.net/satellizer/0.15.5/satellizer.min.js"></script>

NPM

$ npm install satellizer

Bower

$ bower install satellizer

Requirements for Mobile Apps

With any Cordova mobile apps or any framework that uses Cordova, such as Ionic Framework, you will need to add cordova-plugin-inappbrowser plugin:

$ cordova plugin add cordova-plugin-inappbrowser

Make sure that inAppBrowser is listed in your project:

$ cordova plugins
cordova-plugin-console 1.0.2 "Console"
cordova-plugin-device 1.1.1 "Device"
cordova-plugin-inappbrowser 1.3.0 "InAppBrowser"
cordova-plugin-splashscreen 3.2.0 "Splashscreen"
cordova-plugin-statusbar 2.1.1 "StatusBar"
cordova-plugin-whitelist 1.2.1 "Whitelist"
ionic-plugin-keyboard 1.0.8 "Keyboard"

Usage

Step 1. App Module

…

Step 2. Controller

javascript
angular.module('MyApp')
  .controller('LoginCtrl', function($scope, $auth) {

    $scope.authenticate = function(provider) {
      $auth.authenticate(provider);
    };

  });

Step 3. Template

…

Note: For server-side usage please refer to the examples directory.

Configuration

Below is a complete listing of all default configuration options.

…

Browser Support

9+ ✓ ✓ ✓ ✓ ✓

Authentication Flow

Satellizer relies on token-based authentication using JSON Web Tokens instead of cookies.

Additionally, authorization (obtaining user's information with their permission) and authentication (application sign-in) requires sever-side implementation. See provided examples implemented in multiple languages for your convenience. In other words, you cannot just launch your AngularJS application and expect everything to work. The only exception is when you use OAuth 2.0 Implicit Grant (client-side) authorization by setting responseType: 'token' in provider's configuration.

Login with Email and Password

  1. Client: Enter your email and password into the login form.
  2. Client: On form submit call $auth.login() with email and password.
  3. Client: Send a POST request to /auth/login.
  4. Server: Check if email exists, if not - return 401.
  5. Server: Check if password is correct, if not - return 401.
  6. Server: Create a JSON Web Token and send it back to the client.
  7. Client: Parse the token and save it to Local Storage for subsequent use after page reload.

Login with OAuth 1.0

  1. Client: Open an empty popup window via $auth.authenticate('provider name').
  2. Client: Unlike OAuth 2.0, with OAuth 1.0 you cannot go directly to the authorization screen without a valid request_token.
  3. Client: The OAuth 1.0 flow starts with an empty POST request to /auth/provider.
  4. Server: Obtain and return request_tokenfor the authorization popup.
  5. Client: Set the URL location of a popup to the authorizationEndpoint with a valid request_token query parameter, as well as popup options for height and width. This will redirect a user to the authorization screen. After this point, the flow is very similar to OAuth 2.0.
  6. Client: Sign in with your username and password if necessary, then authorize the application.
  7. Client: Send a POST request back to the /auth/provider with oauth_token and oauth_verifier query parameters.
  8. Server: Do an OAuth-signed POST request to the /access_token URL since we now have oauth_token and oauth_verifier parameters.
  9. Server: Look up the user by their unique Provider ID. If user already exists, grab the existing user, otherwise create a new user account.
  10. Server: Create a JSON Web Token and send it back to the client.
  11. Client: Parse the token and save it to Local Storage for subsequent use after page reload.

Login with OAuth 2.0

  1. Client: Open a popup window via $auth.authenticate('provider name').
  2. Client: Sign in with that provider, if necessary, then authorize the application.
  3. Client: After successful authorization, the popup is redirected back to your app, e.g. http://localhost:3000, with the code (authorization code) query string parameter.
  4. Client: The code parameter is sent back to the parent w

Issues· 289 open

View all issuesOpen on GitHub
  • #1136

    popup not closing at /callback url

    Updated Apr 13, 2026
  • #1150

    TiktTok Login compatibility using satellizer

    Updated Nov 10, 2021
  • #1146

    redirect_uri Error on Anroid Devices using Satellizer/Angularjs/Cordova

    Updated Jun 12, 2020
  • #1145

    When I load my website the word "#hello" comes first Opencart website

    Updated May 29, 2020
  • #1139

    LinkedIn scope parameter problem

    Updated Feb 18, 2020
  • #1142

    Instagram Redirect URI Issue on Cordova

    Updated Jan 24, 2020
  • #810

    window.open blocked in Facebook/Messenger in-app browser

    Updated Jan 11, 2020
  • #1141

    Regarding callbackurl for twitter

    Updated Jan 9, 2020
  • #666

    Facebook:Missing Authorization code - Laravel + AngularJS

    phpfacebookawaiting replyUpdated Nov 20, 2019
  • #1123

    facebook auth no longer working - Can't load URL

    Updated Mar 29, 2019

> Tags

TypeScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言