| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project is archived and has not been maintained for 12 years.
This project provides an implementation of a client-side (implicit grant) OAuth 2.0 authorization flow.
Retrieval of a user's token using popups using the promise-based Token.getTokenByPopup() function, that presents the user with the authorization endpoint and returns the token asynchronously.
(Implementation detail: A successfully obtained access token is handed back to the parent window via window.opener.postMessage and the source and origin of the sending window are verified by the parent.)
Access token verification using Token.verifyAsync, by requesting token information from the authorization server, verifying that the token is valid and that it was generated by the current client (to prevent the confused deputy problem).
Storage and retrieval of tokens via the Token.get and Token.set calls in the Token service.
A preconfigured module for use with Google authentication. Check out the example/js/demo.js and example/demo.html for an example.
Check out the demo by going to example/demo.html via rawhithub.com.
Create a project in the Google APIs Console. In the "API Access" tab of the console, create an OAuth 2.0 client ID. When prompted, set the following settings:
Edit authorized redirect URIs and JavaScript origins to match where you will be hosting your site. For example, let's say you're planning to host your site at https://example.com/. In that case, you might upload the angular-oauth code to https://example.com/angular-oauth/. You would then set your client ID settings accordingly:
Add googleOauth as a dependency to your app.
Configure the TokenProvider with the following minimal settings:
For example:
config(function(TokenProvider) {
TokenProvider.extendConfig({
clientId: '191261111313.apps.googleusercontent.com',
redirectUri: 'http://localhost:9000/oauth2callback.html',
scopes: ["https://www.googleapis.com/auth/userinfo.email"]
});
}).
After doing this, you can inject the Token service and enjoy its methods:
This is a work in progress! Don't use it in production. Here's some of what's yet to be done:
Security. While some mechanisms have been implemented to prevent token stealing, the project needs a systematic review of weaknesses. Some things to look out for are outlined in the OAuth specification, which also links to other resources.
I also don't have intimate knowledge of the browser security model. The isolation of localStorage.
Testing. Still lacking some confidence in this area, but soon enough I'll need to do something about the lack of tests.
Customization. Users may not always want to use popups. Perhaps taking over the entire browser window is more appropriate in some cases. (The reason for focusing on popup support is that tokens may expire, and ideally reauthentication should be able to occur without interrupting the state of the application.)
Browser compatibility and fault-tolerance.
It would be nice to support more authorization servers out of the box.
| Back | FazBrowse Home | New Git URL |