{"id":15304568,"url":"https://github.com/monkeymars/satellizer","last_synced_at":"2025-10-08T09:30:55.747Z","repository":{"id":149889843,"uuid":"43727915","full_name":"monkeymars/satellizer","owner":"monkeymars","description":"Token-based AngularJS Authentication","archived":false,"fork":true,"pushed_at":"2015-10-04T15:03:08.000Z","size":6268,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-02T07:56:49.830Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://satellizer.herokuapp.com","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"sahat/satellizer","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monkeymars.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-06T03:27:56.000Z","updated_at":"2015-10-06T03:27:59.000Z","dependencies_parsed_at":"2023-04-22T16:01:18.449Z","dependency_job_id":null,"html_url":"https://github.com/monkeymars/satellizer","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkeymars%2Fsatellizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkeymars%2Fsatellizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkeymars%2Fsatellizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkeymars%2Fsatellizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monkeymars","download_url":"https://codeload.github.com/monkeymars/satellizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235700110,"owners_count":19031668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T07:57:00.947Z","updated_at":"2025-10-08T09:30:49.884Z","avatar_url":"https://github.com/monkeymars.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Project Logo](https://lh6.googleusercontent.com/-YmfKZZLZKL0/U-KVPFSbiOI/AAAAAAAAEZA/maoYT8iJCnA/w1089-h513-no/sshot-1.png)\n\n# [Satellizer](https://github.com/sahat/satellizer/) \n\n[![Join the chat at https://gitter.im/sahat/satellizer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sahat/satellizer?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Build Status](http://img.shields.io/travis/sahat/satellizer.svg?style=flat)](https://travis-ci.org/sahat/satellizer)\n[![Test Coverage](http://img.shields.io/codeclimate/coverage/github/sahat/satellizer.svg?style=flat)](https://codeclimate.com/github/sahat/satellizer)\n[![Version](http://img.shields.io/badge/version-0.12.5-orange.svg?style=flat)](https://www.npmjs.org/package/satellizer)\n\n**Live Demo:** [https://satellizer.herokuapp.com](https://satellizer.herokuapp.com)\n\n---\n\n**Satellizer** is a simple to use, end-to-end, token-based authentication module\nfor [AngularJS](http://angularjs.org) with built-in support for Google, Facebook,\nLinkedIn, Twitter, GitHub, Yahoo, Twitch, Microsoft OAuth providers, as well as Email\nand Password sign-in. However, you are not limited to the sign-in options above, in fact\nyou can add any *OAuth 1.0* or *OAuth 2.0* provider by passing provider-specific information\nin the app *config* block.\n\n![Screenshot](https://lh4.googleusercontent.com/-0UUIecT-3N4/U-LQJkd75iI/AAAAAAAAEZY/YN3Oe-eUPGc/w1676-h1158-no/satellizer.png)\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [Browser Support](#browser-support)\n- [How It Works](#how-it-works)\n- [Obtaining OAuth Keys](#obtaining-oauth-keys)\n- [API Reference](#api-reference)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\nThe easiest way to get **Satellizer** is by running one of the following\ncommands:\n\n```bash\n# Bower\nbower install satellizer\n\n# NPM\nnpm install satellizer\n```\n\nAlternatively, you may [**download**](https://github.com/sahat/satellizer/releases) the latest release or use the CDN:\n\n```html\n\u003c!--[if lte IE 9]\u003e\n\u003cscript src=\"//cdnjs.cloudflare.com/ajax/libs/Base64/0.3.0/base64.min.js\"\u003e\u003c/script\u003e\n\u003c![endif]--\u003e\n\u003cscript src=\"//cdn.jsdelivr.net/satellizer/0.12.5/satellizer.min.js\"\u003e\u003c/script\u003e\n```\n\n**Note:** Sattelizer depends on [`window.atob()`](https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/atob) for decoding JSON Web Tokens. If you need to support *IE9* then use Base64 polyfill above.\n\n\n## Usage\n\n**Step 1. App Module**\n```js\nangular.module('MyApp', ['satellizer'])\n  .config(function($authProvider) {\n\n    $authProvider.facebook({\n      clientId: 'Facebook App ID'\n    });\n\n    $authProvider.google({\n      clientId: 'Google Client ID'\n    });\n\n    $authProvider.github({\n      clientId: 'GitHub Client ID'\n    });\n\n    $authProvider.linkedin({\n      clientId: 'LinkedIn Client ID'\n    });\n\n    $authProvider.yahoo({\n      clientId: 'Yahoo Client ID / Consumer Key'\n    });\n\n    $authProvider.live({\n      clientId: 'Microsoft Client ID'\n    });\n\n    $authProvider.twitch({\n      clientId: 'Twitch Client ID'\n    });\n\n    // No additional setup required for Twitter\n\n    $authProvider.oauth2({\n      name: 'foursquare',\n      url: '/auth/foursquare',\n      clientId: 'Foursquare Client ID',\n      redirectUri: window.location.origin,\n      authorizationEndpoint: 'https://foursquare.com/oauth2/authenticate',\n    });\n\n  });\n```\n\n**Step 2. Controller**\n```js\nangular.module('MyApp')\n  .controller('LoginCtrl', function($scope, $auth) {\n\n    $scope.authenticate = function(provider) {\n      $auth.authenticate(provider);\n    };\n\n  });\n```\n\n**Step 3. Template**\n```html\n\u003cbutton ng-click=\"authenticate('facebook')\"\u003eSign in with Facebook\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('google')\"\u003eSign in with Google\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('github')\"\u003eSign in with GitHub\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('linkedin')\"\u003eSign in with LinkedIn\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('twitter')\"\u003eSign in with Twitter\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('foursquare')\"\u003eSign in with Foursquare\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('yahoo')\"\u003eSign in with Yahoo\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('live')\"\u003eSign in with Windows Live\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('twitch')\"\u003eSign in with Twitch\u003c/button\u003e\n```\n\n**Note:** For server-side usage please refer to the [**examples**](https://github.com/sahat/satellizer/tree/master/examples/server)\ndirectory.\n\n## Configuration\n\nBelow is a complete listing of all default configuration options.\n\n```js\n$authProvider.httpInterceptor = true;\n$authProvider.withCredentials = true;\n$authProvider.tokenRoot = null;\n$authProvider.cordova = false;\n$authProvider.baseUrl = '/';\n$authProvider.loginUrl = '/auth/login';\n$authProvider.signupUrl = '/auth/signup';\n$authProvider.unlinkUrl = '/auth/unlink/';\n$authProvider.tokenName = 'token';\n$authProvider.tokenPrefix = 'satellizer';\n$authProvider.authHeader = 'Authorization';\n$authProvider.authToken = 'Bearer';\n$authProvider.storageType = 'localStorage';\n\n// Facebook\n$authProvider.facebook({\n  url: '/auth/facebook',\n  authorizationEndpoint: 'https://www.facebook.com/v2.3/dialog/oauth',\n  redirectUri: (window.location.origin || window.location.protocol + '//' + window.location.host) + '/',\n  requiredUrlParams: ['display', 'scope'],\n  scope: ['email'],\n  scopeDelimiter: ',',\n  display: 'popup',\n  type: '2.0',\n  popupOptions: { width: 580, height: 400 }\n});\n\n// Google\n$authProvider.google({\n  url: '/auth/google',\n  authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',\n  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,\n  requiredUrlParams: ['scope'],\n  optionalUrlParams: ['display'],\n  scope: ['profile', 'email'],\n  scopePrefix: 'openid',\n  scopeDelimiter: ' ',\n  display: 'popup',\n  type: '2.0',\n  popupOptions: { width: 452, height: 633 }\n});\n\n// GitHub\n$authProvider.github({\n  url: '/auth/github',\n  authorizationEndpoint: 'https://github.com/login/oauth/authorize',\n  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,\n  optionalUrlParams: ['scope'],\n  scope: ['user:email'],\n  scopeDelimiter: ' ',\n  type: '2.0',\n  popupOptions: { width: 1020, height: 618 }\n});\n\n// LinkedIn\n$authProvider.linkedin({\n  url: '/auth/linkedin',\n  authorizationEndpoint: 'https://www.linkedin.com/uas/oauth2/authorization',\n  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,\n  requiredUrlParams: ['state'],\n  scope: ['r_emailaddress'],\n  scopeDelimiter: ' ',\n  state: 'STATE',\n  type: '2.0',\n  popupOptions: { width: 527, height: 582 }\n});\n\n// Twitter\n$authProvider.twitter({\n  url: '/auth/twitter',\n  authorizationEndpoint: 'https://api.twitter.com/oauth/authenticate',\n  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,\n  type: '1.0',\n  popupOptions: { width: 495, height: 645 }\n});\n\n// Twitch\n$authProvider.twitch({\n  url: '/auth/twitch',\n  authorizationEndpoint: 'https://api.twitch.tv/kraken/oauth2/authorize',\n  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,\n  requiredUrlParams: ['scope'],\n  scope: ['user_read'],\n  scopeDelimiter: ' ',\n  display: 'popup',\n  type: '2.0',\n  popupOptions: { width: 500, height: 560 }\n});\n\n// Windows Live\n$authProvider.live({\n  url: '/auth/live',\n  authorizationEndpoint: 'https://login.live.com/oauth20_authorize.srf',\n  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,\n  requiredUrlParams: ['display', 'scope'],\n  scope: ['wl.emails'],\n  scopeDelimiter: ' ',\n  display: 'popup',\n  type: '2.0',\n  popupOptions: { width: 500, height: 560 }\n});\n\n// Yahoo\n$authProvider.yahoo({\n  url: '/auth/yahoo',\n  authorizationEndpoint: 'https://api.login.yahoo.com/oauth2/request_auth',\n  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,\n  scope: [],\n  scopeDelimiter: ',',\n  type: '2.0',\n  popupOptions: { width: 559, height: 519 }\n});\n\n// Generic OAuth 2.0\n$authProvider.oauth2({\n  name: null,\n  url: null,\n  clientId: null,\n  redirectUri: null,\n  authorizationEndpoint: null,\n  defaultUrlParams: ['response_type', 'client_id', 'redirect_uri'],\n  requiredUrlParams: null,\n  optionalUrlParams: null,\n  scope: null,\n  scopePrefix: null,\n  scopeDelimiter: null,\n  state: null,\n  type: null,\n  popupOptions: null,\n  responseType: 'code',\n  responseParams: {\n    code: 'code',\n    clientId: 'clientId',\n    redirectUri: 'redirectUri'\n  }\n});\n\n// Generic OAuth 1.0\n$authProvider.oauth1({\n  name: null,\n  url: null,\n  authorizationEndpoint: null\n  redirectUri: null,\n  type: null,\n  popupOptions: null\n});\n```\n\n## Browser Support\n\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Internet_Explorer_9_icon.svg/2000px-Internet_Explorer_9_icon.svg.png\" height=\"40\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg src=\"http://img3.wikia.nocookie.net/__cb20120330024137/logopedia/images/d/d7/Google_Chrome_logo_2011.svg\" height=\"40\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg src=\"http://media.idownloadblog.com/wp-content/uploads/2014/06/Safari-logo-OS-X-Yosemite.png\" height=\"40\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg src=\"http://th09.deviantart.net/fs71/200H/f/2013/185/e/b/firefox_2013_vector_icon_by_thegoldenbox-d6bxsye.png\" height=\"40\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg src=\"http://upload.wikimedia.org/wikipedia/commons/d/d4/Opera_browser_logo_2013.png\" height=\"40\"\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e9*\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e✓\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e✓\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e✓\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e✓\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n__*__ Requires [Base64](https://github.com/davidchambers/Base64.js/) polyfill.\n\n## How It Works\n\n**Satellizer** relies on *token-based authentication* using\n[JSON Web Tokens](https://auth0.com/blog/2014/01/07/angularjs-authentication-with-cookies-vs-token/)\ninstead of cookies. Each **Wiki** link below goes in-depth into how the\nauthentication process works.\n\n- [Login with OAuth 2.0](https://github.com/sahat/satellizer/wiki/Login-with-OAuth-2.0)\n- [Login with OAuth 1.0](https://github.com/sahat/satellizer/wiki/Login-with-OAuth-1.0)\n- [Login with Email and Password](https://github.com/sahat/satellizer/wiki/Login-with-Email-and-Password)\n- [Signup](https://github.com/sahat/satellizer/wiki/Signup)\n- [Logout](https://github.com/sahat/satellizer/wiki/Logout)\n\n**Note:** To learn more about JSON Web Token (JWT) visit [JWT.io](http://jwt.io/).\n\n## Obtaining OAuth Keys\n\n- [ ] TODO: Replace with screencasts.\n\n\u003cimg src=\"http://images.google.com/intl/en_ALL/images/srpr/logo6w.png\" width=\"150\"\u003e\n- Visit [Google Cloud Console](https://cloud.google.com/console/project)\n- Click **CREATE PROJECT** button\n- Enter *Project Name*, then click **CREATE**\n- Then select *APIs \u0026 auth* from the sidebar and click on *Credentials* tab\n- Click **CREATE NEW CLIENT ID** button\n - **Application Type**: Web Application\n - **Authorized Javascript origins**: *http://localhost:3000*\n - **Authorized redirect URI**: *http://localhost:3000*\n\n**Note:** Make sure you have turned on **Contacts API** and **Google+ API** in the *APIs* tab.\n\n\u003chr\u003e\n\n\u003cimg src=\"http://www.doit.ba/img/facebook.jpg\" width=\"150\"\u003e\n- Visit [Facebook Developers](https://developers.facebook.com/)\n- Click **Apps \u003e Create a New App** in the navigation bar\n- Enter *Display Name*, then choose a category, then click **Create app**\n- Click on *Settings* on the sidebar, then click **+ Add Platform**\n- Select **Website**\n- Enter *http://localhost:3000* for *Site URL*\n\n\u003chr\u003e\n\n\u003cimg src=\"https://g.twimg.com/Twitter_logo_blue.png\" height=\"70\"\u003e\n- Sign in at [https://apps.twitter.com](https://apps.twitter.com/)\n- Click on **Create New App**\n- Enter your *Application Name*, *Description* and *Website*\n- For **Callback URL**: *http://127.0.0.1:3000*\n- Go to **Settings** tab\n- Under *Application Type* select **Read and Write** access\n- Check the box **Allow this application to be used to Sign in with Twitter**\n- Click **Update this Twitter's applications settings**\n\n\u003chr\u003e\n\n\u003cimg src=\"http://blogs.unity3d.com/wp-content/uploads/2013/12/New-Microsoft-Logo.png\" width=\"150\"\u003e\n- Visit [Live Connect App Management](http://go.microsoft.com/fwlink/p/?LinkId=193157).\n- Click on **Create application**\n- Enter an *Application name*, then click on **I accept** button\n- Go to **API Settings** tab\n- Enter a *Redirect URL*\n- Click **Save**\n- Go to **App Settings** tab to get *Client ID* and *Client Secret*\n\n\u003e **Note:** Microsoft does not consider `localhost` or `127.0.0.1` to be a valid URL.\nAs a workaround for local development add `127.0.0.1 mylocalwebsite.net` to **/etc/hosts** file\nand specify `mylocalwebsite.net` as your *Redirect URL* in the **API Settings** tab.\n\n\n## API Reference\n\n- [`$auth.login(user, [options])`](#authloginuser-options)\n- [`$auth.signup(user, [options])`](#authsignupuser-options)\n- [`$auth.authenticate(name, [userData])`](#authauthenticatename-userdata)\n- [`$auth.logout()`](#authlogout)\n- [`$auth.isAuthenticated()`](#authisauthenticated)\n- [`$auth.link(name, [userData])`](#authlinkname-userdata)\n- [`$auth.unlink(name, [options])`](#authunlinkname-options)\n- [`$auth.getToken()`](#authgettoken)\n- [`$auth.getPayload()`](#authgetpayload)\n- [`$auth.setToken(token)`](#authsettokentoken)\n- [`$auth.removeToken()`](#authremovetoken)\n- [`$auth.setStorageType(type)`](#authsetstoragetypetype)\n\n#### `$auth.login(user, [options])`\n\nSign in using Email and Password.\n\n##### Parameters\n\n| Param                    | Type     | Details\n| ------------------------ | -------- | ---------------------------------------------------------------------------------------\n| **user**                 | `Object` | JavaScript object containing user information.\n| **options** *(optional)* | `Object` | HTTP config object. See [`$http(config)`](https://docs.angularjs.org/api/ng/service/$http) docs.\n\n##### Returns\n\n- **response** - The HTTP response object from the server.\n\n##### Usage\n\n```js\nvar user = {\n  email: $scope.email,\n  password: $scope.password\n};\n\n$auth.login(user)\n  .then(function(response) {\n    // Redirect user here after a successful log in.\n  })\n  .catch(function(response) {\n    // Handle errors here, such as displaying a notification\n    // for invalid email and/or password.\n  });\n```\n\n\u003chr\u003e\n\n#### `$auth.signup(user, [options])`\n\nCreate a new account with Email and Password.\n\n##### Parameters\n\n| Param                    | Type     | Details\n| ------------------------ | -------- | ---------------------------------------------------------------------------------------\n| **user**                 | `Object` | JavaScript object containing user information.\n| **options** *(optional)* | `Object` | HTTP config object. See [`$http(config)`](https://docs.angularjs.org/api/ng/service/$http) docs.\n\n##### Returns\n\n- **response** - The HTTP response object from the server.\n\n##### Usage\n\n```js\nvar user = {\n  firstName: $scope.firstName,\n  lastName: $scope.lastName,\n  email: $scope.email,\n  password: $scope.password\n};\n\n$auth.signup(user)\n  .then(function(response) {\n    // Redirect user here to login page or perhaps some other intermediate page\n    // that requires email address verification before any other part of the site\n    // can be accessed.\n  })\n  .catch(function(response) {\n    // Handle errors here.\n  });\n```\n\n\u003chr\u003e\n\n#### `$auth.authenticate(name, [userData])`\n\nStarts the OAuth 1.0 or the OAuth 2.0 authorization flow by opening a popup window.\n\n##### Parameters\n\n| Param                     | Type     | Details\n| ------------------------- | -------- | --------------------------------------------------------------------------------\n| **name**                  | `String` | One of the built-in or custom OAuth provider names created via `$authProvider.oauth1()` or `$authProvider.oauth2()`.\n| **userData** *(optional)* | `Object` | If you need to send additional data to the server along with `code`, `clientId` and `redirectUri` (OAuth 2.0) or `oauth_token` and `oauth_verifier` (OAuth 1.0).\n\n##### Returns\n\n- **response** - The HTTP response object from the server.\n\n##### Usage\n\n```js\n$auth.authenticate('google')\n  .then(function(response) {\n    // Signed in with Google.\n  })\n  .catch(function(response) {\n    // Something went wrong.\n  });\n```\n\n\u003chr\u003e\n\n#### `$auth.logout()`\n\nDeletes a token from Local Storage (or Session Storage).\n\n##### Usage\n\n```js\n$auth.logout();\n```\n\n\u003chr\u003e\n\n#### `$auth.isAuthenticated()`\n\nChecks authentication status of a user.\n\n| State                                  | True     | False\n| -------------------------------------- | -------- | -------\n| No token in Local Storage              |          | ✓\n| Token present, but not a valid JWT     | ✓        |\n| JWT present without [`exp`]((http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#expDef))              | ✓        |\n| JWT present with [`exp`]((http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#expDef)) and not expired | ✓        |\n| JWT present with [`exp`]((http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#expDef)) and expired     |          | ✓\n\n##### Usage\n\n```js\n// Controller\n$scope.isAuthenticated = function() {\n  return $auth.isAuthenticated();\n};\n```\n\n```html\n\u003c!-- Template --\u003e\n\u003cul ng-if=\"!isAuthenticated()\"\u003e\n  \u003cli\u003e\u003ca href=\"/login\"\u003eLogin\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"/signup\"\u003eSign up\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cul ng-if=\"isAuthenticated()\"\u003e\n  \u003cli\u003e\u003ca href=\"/logout\"\u003eLogout\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n```\n\n\u003chr\u003e\n\n#### `$auth.link(name, [userData])`\n\nAlias for [`$auth.authenticate(name, [userData])`](#authauthenticatename-userdata).\n\n:bulb: **Note:** Account linking (and merging) business logic is handled entirely on the server.\n\n##### Usage\n\n```js\n// Controller\n$scope.link = function(provider) {\n  $auth.link(provider)\n    .then(function(response) {\n      // You have successfully linked an account.\n    })\n    .catch(function(response) {\n      // Handle errors here.\n    });\n};\n```\n\n```html\n\u003c!-- Template --\u003e\n\u003cbutton ng-click=\"link('facebook')\"\u003e\n  Connect Facebook Account\n\u003c/button\u003e\n```\n\u003chr\u003e\n\n#### `$auth.unlink(name, [options])`\n\nUnlinks an OAuth provider.\n\nBy default, sends a POST request to `/auth/unlink` with the `{ provider: name }` data object.\n\n##### Parameters\n\n| Param                     | Type     | Details\n| ------------------------- | -------- | --------------------------------------------------------------------------------\n| **name**                  | `String` | One of the built-in or custom OAuth provider names created via `$authProvider.oauth1()` or `$authProvider.oauth2()`.\n| **options** *(optional)*  | `Object` | HTTP config object. See [`$http(config)`](https://docs.angularjs.org/api/ng/service/$http) docs.\n\n\n##### Returns\n\n- **response** - The HTTP response object from the server.\n\n##### Usage\n\n```js\n$auth.unlink('github')\n  .then(function(response) {\n    // You have unlinked a GitHub account.\n  })\n  .catch(function(response) {\n    // Handle errors here.\n  });\n```\n\n\u003chr\u003e\n\n#### `$auth.getToken()`\n\nReturns a token from Local Storage (or Session Storage).\n\n```js\n$auth.getToken();\n// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEyMzQ1Njc4OTAsIm5hbWUiOiJKb2huIERvZSJ9.kRkUHzvZMWXjgB4zkO3d6P1imkdp0ogebLuxnTCiYUU\n```\n\n\u003chr\u003e\n\n#### `$auth.getPayload()`\n\nReturns a JWT Claims Set, i.e. the middle part of a JSON Web Token.\n\n##### Usage\n\n```js\n$auth.getPayload();\n// { exp: 1414978281, iat: 1413765081, userId: \"544457a3eb129ee822a38fdd\" }\n```\n\n\u003chr\u003e\n\n#### `$auth.setToken(token)`\n\nSaves a JWT or an access token to Local Storage / Session Storage.\n\n##### Parameters\n\n| Param                    | Type     | Details\n| ------------------------ | -------- | ---------------------------------------------------------------------------------------\n| **token**                | `Object` | An object that takes a JWT (`response.data[config.tokenName]`) or an access token (`response.access_token`).\n\n\u003chr\u003e\n\n#### `$auth.removeToken()`\n\nRemoves a token from Local Storage / Session Storage. Used internally by [`$auth.logout()`](#authlogout).\n\n##### Usage\n\n```js\n$auth.removeToken();\n```\n\n\u003chr\u003e\n\n#### `$auth.setStorageType(type)`\n\nSets storage type to Local Storage or Session Storage.\n\n##### Parameters\n\n| Param                    | Type     | Details\n| ------------------------ | -------- | -------------------------------------------------------\n| **type**                 | `String` | Accepts `'localStorage'` and `'sessionStorage'` values.\n\n##### Usage\n\n```js\n$auth.setStorageType('sessionStorage');\n```\n\n## Credits\n\n| Contribution               | User\n| -------------------------- | --------------------------------------\n| Dropwizard (Java) Example  | [Alice Chen](https://github.com/chena)\n| Go Example                 | [Salim Alami](https://github.com/celrenheit)\n| Ruby on Rails Example      | [Simonas Gildutis](https://github.com/simonasdev)\n| Ionic Framework Example    | [Dimitris Bozelos](https://github.com/krystalcode)\n\nAdditionally, I would like to thank all other contributors who have reported\nbugs, submitted pull requests and suggested new features!\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014-2015 Sahat Yalkabov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonkeymars%2Fsatellizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonkeymars%2Fsatellizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonkeymars%2Fsatellizer/lists"}