{"id":13406876,"url":"https://github.com/sahat/satellizer","last_synced_at":"2025-05-13T00:15:04.897Z","repository":{"id":18307954,"uuid":"21486287","full_name":"sahat/satellizer","owner":"sahat","description":"Token-based AngularJS Authentication","archived":false,"fork":false,"pushed_at":"2023-12-17T15:43:16.000Z","size":6703,"stargazers_count":7838,"open_issues_count":290,"forks_count":1126,"subscribers_count":218,"default_branch":"master","last_synced_at":"2025-05-10T22:25:00.571Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://satellizer-sahat.rhcloud.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sahat.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-07-04T05:22:38.000Z","updated_at":"2025-05-10T19:42:23.000Z","dependencies_parsed_at":"2024-01-11T19:18:48.137Z","dependency_job_id":"327b6f26-9ee1-42f3-ba72-2207dc639d80","html_url":"https://github.com/sahat/satellizer","commit_stats":{"total_commits":1802,"total_committers":142,"mean_commits":"12.690140845070422","dds":0.1925638179800222,"last_synced_commit":"ae2863338ab7214e8f3be7b5fae6373a18d7a11b"},"previous_names":["sahat/ngauth"],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahat%2Fsatellizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahat%2Fsatellizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahat%2Fsatellizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahat%2Fsatellizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sahat","download_url":"https://codeload.github.com/sahat/satellizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253625853,"owners_count":21938209,"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-07-30T19:02:41.800Z","updated_at":"2025-05-13T00:15:04.871Z","avatar_url":"https://github.com/sahat.png","language":"TypeScript","readme":"![Project Logo](http://i.imgur.com/yutNy7x.jpg)\n\n# [Satellizer](https://github.com/sahat/satellizer/)\n\n[![Donate](https://img.shields.io/badge/paypal-donate-blue.svg)](https://paypal.me/sahat)\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[![npm version](https://badge.fury.io/js/satellizer.svg)](https://badge.fury.io/js/satellizer)\n[![Book session on Codementor](https://cdn.codementor.io/badges/book_session_github.svg)](https://www.codementor.io/sahatyalkabov?utm_source=github\u0026utm_medium=button\u0026utm_term=sahatyalkabov\u0026utm_campaign=github)\n[![OpenCollective](https://opencollective.com/satellizer/backers/badge.svg)](#backers)\n[![OpenCollective](https://opencollective.com/satellizer/sponsors/badge.svg)](#sponsors)\n\n[**Live Demo**](https://satellizer-sahat.rhcloud.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, Instagram, GitHub, Bitbucket, Yahoo, Twitch, Microsoft (Windows Live) 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## Backers\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/satellizer#backer)]\n\n\u003ca href=\"https://opencollective.com/satellizer/backer/0/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/0/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/1/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/1/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/2/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/2/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/3/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/3/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/4/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/4/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/5/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/5/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/6/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/6/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/7/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/7/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/8/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/8/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/9/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/9/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/10/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/10/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/11/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/11/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/12/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/12/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/13/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/13/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/14/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/14/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/15/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/15/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/16/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/16/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/17/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/17/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/18/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/18/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/19/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/19/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/20/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/20/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/21/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/21/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/22/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/22/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/23/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/23/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/24/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/24/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/25/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/25/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/26/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/26/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/27/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/27/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/28/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/28/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/backer/29/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/backer/29/avatar.svg\"\u003e\u003c/a\u003e\n\n## Sponsors\nBecome a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/satellizer#sponsor)]\n\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/0/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/0/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/1/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/1/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/2/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/2/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/3/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/3/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/4/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/4/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/5/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/5/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/6/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/6/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/7/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/7/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/8/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/8/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/9/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/9/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/10/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/10/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/11/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/11/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/12/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/12/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/13/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/13/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/14/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/14/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/15/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/15/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/16/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/16/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/17/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/17/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/18/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/18/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/19/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/19/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/20/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/20/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/21/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/21/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/22/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/22/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/23/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/23/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/24/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/24/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/25/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/25/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/26/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/26/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/27/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/27/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/28/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/28/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/satellizer/sponsor/29/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/satellizer/sponsor/29/avatar.svg\"\u003e\u003c/a\u003e\n\n## Table of Contents\n\n- [Installation](#installation)\n - [Requirements for Mobile Apps](#requirements-for-mobile-apps)\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [Browser Support](#browser-support)\n- [Authentication Flow](#authentication-flow)\n - [Login with Email and Password](#-login-with-email-and-password)\n - [Login with OAuth 1.0](#-login-with-oauth-10)\n - [Login with OAuth 2.0](#-login-with-oauth-20)\n - [Logout](#-log-out)\n- [Obtaining OAuth Keys](#obtaining-oauth-keys)\n- [API Reference](#api-reference)\n- [FAQ](#faq)\n- [Community Resources](#community-resources)\n- [Backers](#backers)\n- [Sponsors](#sponsors)\n- [Credits](#credits)\n- [License](#license)\n\n## Installation\n\n#### \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/e/e2/Google_Chrome_icon_%282011%29.svg\" height=\"22\" align=\"top\"\u003e Browser\n\n```html\n\u003cscript src=\"angular.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"satellizer.js\"\u003e\u003c/script\u003e\n```\n```html\n\u003c!-- Satellizer CDN --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/satellizer/0.15.5/satellizer.min.js\"\u003e\u003c/script\u003e\n```\n\n#### \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/d/db/Npm-logo.svg\" height=\"22\" align=\"top\"\u003e NPM\n\n```\n$ npm install satellizer\n```\n\n#### \u003cimg src=\"https://bower.io/img/bower-logo.svg\" height=\"22\" align=\"top\"\u003e Bower\n\n```\n$ bower install satellizer\n```\n\n### Requirements for Mobile Apps\n\nWith any Cordova mobile apps or any framework that uses Cordova, such as [Ionic Framework](http://ionicframework.com/), you will need to add [cordova-plugin-inappbrowser](https://cordova.apache.org/docs/en/3.0.0/cordova/inappbrowser/inappbrowser.html) plugin:\n\n```\n$ cordova plugin add cordova-plugin-inappbrowser\n```\n\nMake sure that **inAppBrowser** is listed in your project:\n\n```\n$ cordova plugins\ncordova-plugin-console 1.0.2 \"Console\"\ncordova-plugin-device 1.1.1 \"Device\"\ncordova-plugin-inappbrowser 1.3.0 \"InAppBrowser\"\ncordova-plugin-splashscreen 3.2.0 \"Splashscreen\"\ncordova-plugin-statusbar 2.1.1 \"StatusBar\"\ncordova-plugin-whitelist 1.2.1 \"Whitelist\"\nionic-plugin-keyboard 1.0.8 \"Keyboard\"\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    // Optional: For client-side use (Implicit Grant), set responseType to 'token' (default: 'code')\n    $authProvider.facebook({\n      clientId: 'Facebook App ID',\n      responseType: 'token'\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.instagram({\n      clientId: 'Instagram 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    $authProvider.bitbucket({\n      clientId: 'Bitbucket Client ID'\n    });\n\n    $authProvider.spotify({\n      clientId: 'Spotify 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('instagram')\"\u003eSign in with Instagram\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\u003cbutton ng-click=\"authenticate('bitbucket')\"\u003eSign in with Bitbucket\u003c/button\u003e\n\u003cbutton ng-click=\"authenticate('spotify')\"\u003eSign in with Spotify\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 = function() { return true; },\n$authProvider.withCredentials = false;\n$authProvider.tokenRoot = null;\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.tokenHeader = 'Authorization';\n$authProvider.tokenType = 'Bearer';\n$authProvider.storageType = 'localStorage';\n\n// Facebook\n$authProvider.facebook({\n  name: 'facebook',\n  url: '/auth/facebook',\n  authorizationEndpoint: 'https://www.facebook.com/v2.5/dialog/oauth',\n  redirectUri: window.location.origin + '/',\n  requiredUrlParams: ['display', 'scope'],\n  scope: ['email'],\n  scopeDelimiter: ',',\n  display: 'popup',\n  oauthType: '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,\n  requiredUrlParams: ['scope'],\n  optionalUrlParams: ['display'],\n  scope: ['profile', 'email'],\n  scopePrefix: 'openid',\n  scopeDelimiter: ' ',\n  display: 'popup',\n  oauthType: '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,\n  optionalUrlParams: ['scope'],\n  scope: ['user:email'],\n  scopeDelimiter: ' ',\n  oauthType: '2.0',\n  popupOptions: { width: 1020, height: 618 }\n});\n\n// Instagram\n$authProvider.instagram({\n  name: 'instagram',\n  url: '/auth/instagram',\n  authorizationEndpoint: 'https://api.instagram.com/oauth/authorize',\n  redirectUri: window.location.origin,\n  requiredUrlParams: ['scope'],\n  scope: ['basic'],\n  scopeDelimiter: '+',\n  oauthType: '2.0'\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,\n  requiredUrlParams: ['state'],\n  scope: ['r_emailaddress'],\n  scopeDelimiter: ' ',\n  state: 'STATE',\n  oauthType: '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,\n  oauthType: '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,\n  requiredUrlParams: ['scope'],\n  scope: ['user_read'],\n  scopeDelimiter: ' ',\n  display: 'popup',\n  oauthType: '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,\n  requiredUrlParams: ['display', 'scope'],\n  scope: ['wl.emails'],\n  scopeDelimiter: ' ',\n  display: 'popup',\n  oauthType: '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,\n  scope: [],\n  scopeDelimiter: ',',\n  oauthType: '2.0',\n  popupOptions: { width: 559, height: 519 }\n});\n\n// Bitbucket\n$authProvider.bitbucket({\n  url: '/auth/bitbucket',\n  authorizationEndpoint: 'https://bitbucket.org/site/oauth2/authorize',\n  redirectUri: window.location.origin + '/',\n  optionalUrlParams: ['scope'],\n  scope: ['email'],\n  scopeDelimiter: ' ',\n  oauthType: '2.0',\n  popupOptions: { width: 1020, height: 618 }\n});\n\n// Spotify\n$authProvider.spotify({\n  url: '/auth/spotify',\n  authorizationEndpoint: 'https://accounts.spotify.com/authorize',\n  redirectUri: window.location.origin,\n  optionalUrlParams: ['state'],\n  requiredUrlParams: ['scope'],\n  scope: ['user-read-email'],\n  scopePrefix: '',\n  scopeDelimiter: ',',\n  oauthType: '2.0',\n  popupOptions: { width: 500, height: 530 }\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  oauthType: 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  oauthType: 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=\"35\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg src=\"http://vignette1.wikia.nocookie.net/unanything/images/f/ff/Microsoft_Edge_logo_svg.png/revision/latest?cb=20150728233335\" height=\"35\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg src=\"http://img4.wikia.nocookie.net/__cb20140907211937/logopedia/images/b/b6/Chrome_new_logo.png\" height=\"35\"\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=\"35\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg src=\"https://mozorg.cdn.mozilla.net/media/img/styleguide/identity/firefox/guidelines-logo.7ea045a4e288.png\" height=\"35\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg src=\"http://upload.wikimedia.org/wikipedia/commons/d/d4/Opera_browser_logo_2013.png\" height=\"35\"\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      \u003ctd align=\"center\"\u003e✓\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## Authentication Flow\n\nSatellizer 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.\n\nAdditionally, **authorization** (obtaining user's information with their permission) and **authentication** (application sign-in) requires sever-side implementation. See provided [examples](https://github.com/sahat/satellizer/tree/master/examples/server) 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](https://github.com/sahat/satellizer#configuration).\n\n### \u003cimg height=\"34\" align=\"top\" src=\"http://tech-lives.com/wp-content/uploads/2012/03/Lock-icon.png\"\u003e Login with Email and Password\n\n1. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Enter your email and password into the login form.\n2. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** On form submit call `$auth.login()` with email and password.\n3. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Send a `POST` request to `/auth/login`.\n4. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** Check if email exists, if not - return `401`.\n5. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** Check if password is correct, if not - return `401`.\n6. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** Create a JSON Web Token and send it back to the client.\n7. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Parse the token and save it to *Local Storage* for subsequent\nuse after page reload.\n\n\n### \u003cimg height=\"34\" align=\"top\" src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Oauth_logo.svg/180px-Oauth_logo.svg.png\"\u003e Login with OAuth 1.0\n\n1. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Open an **empty** popup window via `$auth.authenticate('provider name')`.\n2. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Unlike OAuth 2.0, with OAuth 1.0 you cannot go directly to the authorization\nscreen without a valid `request_token`.\n3. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** The OAuth 1.0 flow starts with an empty **POST** request to */auth/provider*.\n4. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** Obtain and return `request_token`for the authorization popup.\n5. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **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.\n6. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Sign in with your username and password if necessary, then authorize\nthe application.\n7. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Send a *POST* request back to the */auth/provider* with\n`oauth_token` and `oauth_verifier` query parameters.\n8. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** Do an OAuth-signed `POST` request to the */access_token* URL since we now have `oauth_token` and\n`oauth_verifier` parameters.\n10. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** Look up the user by their unique *Provider ID*. If user already\nexists, grab the existing user, otherwise create a new user account.\n11. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** Create a JSON Web Token and send it back to the client.\n12. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Parse the token and save it to *Local Storage* for subsequent\nuse after page reload.\n\n\n### \u003cimg height=\"34\" align=\"top\" src=\"https://getkong.org/assets/images/icons/plugins/oauth2-authentication.png\"\u003e Login with OAuth 2.0\n\n1. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Open a popup window via `$auth.authenticate('provider name')`.\n2. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Sign in with that provider, if necessary, then authorize the application.\n3. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** After successful authorization, the popup is redirected back to\nyour app, e.g. *http://localhost:3000*,  with the `code` (authorization code)\nquery string parameter.\n4. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** The `code` parameter is sent back to the  parent window that opened the popup.\n5. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Parent window closes the popup and sends a **POST**\nrequest to */auth/provider* with`code` parameter.\n6. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** *Authorization code* is exchanged for *access token*.\n7. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** User information is retrived using the *access token* from **Step 6**.\n8. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** Look up the user by their unique *Provider ID*. If user already\nexists, grab the existing user, otherwise create a new user account.\n9. \u003cimg height=\"24\" align=\"top\" src=\"http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/256/Places-network-server-database-icon.png\"\u003e **Server:** In both cases of Step 8, create a JSON Web Token and send it back to the client.\n10. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Parse the token and save it to *Local Storage* for subsequent\nuse after page reload.\n\n### \u003cimg height=\"34\" align=\"top\" src=\"http://i.imgur.com/S5Ei6Rj.png\"\u003e Log out\n1. \u003cimg height=\"24\" align=\"top\" src=\"https://i.ytimg.com/i/bn1OgGei-DV7aSRo_HaAiw/mq1.jpg?v=4f8f2cc9\"\u003e **Client:** Remove token from Local Storage.\n\n**Note:** To learn more about JSON Web Tokens visit \u003cimg src=\"http://jwt.io/img/pic_logo.svg\" height=\"22\" align=\"top\"\u003e [JWT.io](http://jwt.io/).\n\n## Obtaining OAuth Keys\n\n\u003cimg src=\"https://camo.githubusercontent.com/204e6b07369021b5b9eb7d228d051aca72a457ef/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f322f32662f476f6f676c655f323031355f6c6f676f2e7376672f3130303070782d476f6f676c655f323031355f6c6f676f2e7376672e706e67\" width=\"150\"\u003e\n- Visit [Google Developer Console](https://console.developers.google.com/iam-admin/projects)\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\u003cimg src=\"https://camo.githubusercontent.com/7318ebef474f99229892e6bf052f0117ca86f0e4/68747470733a2f2f6769746875622e676c6f62616c2e73736c2e666173746c792e6e65742f696d616765732f6d6f64756c65732f6c6f676f735f706167652f4769744875622d4c6f676f2e706e67\" width=\"150\"\u003e\n- Visit [https://github.com/settings/profile](https://github.com/settings/profile)\n- Select **Applications** in the left panel\n- Go to **Developer applications** tab, then click on the **Register new application** button\n - **Application name**: Your app name\n - **Homepage URL**: *http://localhost:3000*\n - **Authorization callback URL**: *http://localhost:3000*\n- Click on the **Register application** button\n\n\u003cimg\nsrc=\"http://i.imgur.com/qCkAeZl.png\"\nwidth=\"150\" /\u003e\n- Visit\n[https://developer.spotify.com](https://developer.spotify.com)\n- Select **My Apps** on the top menu\n- Select **Create an App** on the right side\n - **Application Name**: Your app name\n - **Application Description**: Your app Description\n- Click **Create**\n- Fill out the following:\n - **Redirect URIs**: *http://localhost:3000*\n- Click **Save**\n\n\u003chr\u003e\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. If used client side, [`responseType: \"token\"`](#authentication-flow) is required in the provider setup to get the actual access token.\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## FAQ\n\n#### :question: How do I set `offline_access`?\n\n```js\n$authProvider.google({\n  optionalUrlParams: ['access_type'],\n  accessType: 'offline'\n});\n```\n\n#### :question: Can I change `redirectUri` to something other than base URL?\n\nBy default, `redirectUri` is set to `window.location.origin` (protocol, hostname, port number of a URL) for all OAuth providers. This `redirectUri` must match *exactly* the URL¹ specified in your OAuth app settings.\n\n**Facebook (example)**\n![](http://i.imgur.com/eaykgcZ.png)\n\n\nHowever, you can set `redirectUri` to any URL *path* you desire. For instance, you may follow the naming convention of [Passport.js](http://passportjs.org/):\n```js\n// Note: Must be absolute path.\nwindow.location.origin + '/auth/facebook/facebook/callback'\nwindow.location.origin + '/auth/facebook/google/callback'\n...\n```\n\nUsing the example above, a popup window will be redirected to `http://localhost:3000/auth/facebook/callback?code=YOUR_AUTHORIZATION_CODE` after a successful Facebook authorization. To avoid potential 404 errors, create server routes for each `redirectUri` URL that return **200 OK**. Or alternatively, you may render a custom template with a loading spinner. For the moment, a popup will not stay long enough to see that custom template, due to 20ms interval polling, but in the future I may add support for overriding this polling interval value.\n\nAs far as Satellizer is concerned, it does not matter what is the value of `redirectUri` as long as it matches URL in your OAuth app settings. Satellizer's primary concern is to read URL query/hash parameters, then close a popup.\n\n¹ **Note:** Depending on the OAuth provider, it may be called *Site URL*, *Callback URL*, *Redirect URL*, and so on.\n\n#### :question: How can I send a token in a format other than `Authorization: Bearer \u003ctoken\u003e`?\nIf you are unable to send a token to your server in the following format - `Authorization: Bearer \u003ctoken\u003e`, then use\n**`$authProvider.tokenHeader`** and **`$authProvider.tokenType`** config options to change the header format. The default values are `Authorization` and `Bearer`, respectively.\n\nFor example, if you need to use `Authorization: Basic` header, this is where you change it.\n\n#### :question: How can I avoid sending Authorization header on all HTTP requests?\nBy default, once user is authenticated, JWT will be sent on every request. If you would like to prevent that, you could use `skipAuthorization` option in your `$http` request. For example:\n\n```js\n$http({\n  method: 'GET',\n  url: '/api/endpoint',\n  skipAuthorization: true  // `Authorization: Bearer \u003ctoken\u003e` will not be sent on this request.\n});\n```\n\n#### :question: Is there a way to dynamically change `localStorage` to `sessionStorage`?\nYes, you can toggle between [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionstorage) via the following Satellizer methods:\n- `$auth.setStorageType('sessionStorage');`\n- `$auth.setStorageType('localStorage');`\n\n#### :question: I am having a problem with Ionic authentication on iOS 9.\nFirst, check what kind of error you are getting by opening the Web Inspector from **Develop \u003e Simulator \u003e index.html** menu.\nIf you have configured everything correctly, chances are you running into the following error:\n\n\u003e Failed to load resource: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.\n\nFollow instructions on this [StackOverflow post](http://stackoverflow.com/questions/32631184/the-resource-could-not-be-loaded-because-the-app-transport-security-policy-requi) by adding `NSAppTransportSecurity` to *info.plist*. That should fix the problem.\n\n## Community Resources\n\n### Tutorials\n- Ionic JWT auth with Facebook using Node.js ([Part 1](http://blog.grossman.io/ionic-jwt-auth-with-facebook-using-nodejs-part-1/) and [Part 2](http://blog.grossman.io/ionic-jwt-auth-with-facebook-using-nodejs-part-2-2/))\n- [Build an Instagram clone with AngularJS, Satellizer, Node.js and MongoDB](https://hackhands.com/building-instagram-clone-angularjs-satellizer-nodejs-mongodb/)\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) 2016 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","funding_links":["https://paypal.me/sahat","https://opencollective.com/satellizer","https://opencollective.com/satellizer/backer/0/website","https://opencollective.com/satellizer/backer/1/website","https://opencollective.com/satellizer/backer/2/website","https://opencollective.com/satellizer/backer/3/website","https://opencollective.com/satellizer/backer/4/website","https://opencollective.com/satellizer/backer/5/website","https://opencollective.com/satellizer/backer/6/website","https://opencollective.com/satellizer/backer/7/website","https://opencollective.com/satellizer/backer/8/website","https://opencollective.com/satellizer/backer/9/website","https://opencollective.com/satellizer/backer/10/website","https://opencollective.com/satellizer/backer/11/website","https://opencollective.com/satellizer/backer/12/website","https://opencollective.com/satellizer/backer/13/website","https://opencollective.com/satellizer/backer/14/website","https://opencollective.com/satellizer/backer/15/website","https://opencollective.com/satellizer/backer/16/website","https://opencollective.com/satellizer/backer/17/website","https://opencollective.com/satellizer/backer/18/website","https://opencollective.com/satellizer/backer/19/website","https://opencollective.com/satellizer/backer/20/website","https://opencollective.com/satellizer/backer/21/website","https://opencollective.com/satellizer/backer/22/website","https://opencollective.com/satellizer/backer/23/website","https://opencollective.com/satellizer/backer/24/website","https://opencollective.com/satellizer/backer/25/website","https://opencollective.com/satellizer/backer/26/website","https://opencollective.com/satellizer/backer/27/website","https://opencollective.com/satellizer/backer/28/website","https://opencollective.com/satellizer/backer/29/website"],"categories":["TypeScript","User Manager","Authentication","Table of Contents"],"sub_categories":["Save","Authentication Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahat%2Fsatellizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsahat%2Fsatellizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahat%2Fsatellizer/lists"}