An open API service indexing awesome lists of open source software.

https://github.com/festify/oauth-authorizator

A Polymer 2.0 element that performs the OAuth authorization code flow.
https://github.com/festify/oauth-authorizator

oauth2-authorization polymer web-component

Last synced: 4 months ago
JSON representation

A Polymer 2.0 element that performs the OAuth authorization code flow.

Awesome Lists containing this project

README

          

# \

A Polymer 2.0 Element that performs the OAuth2 authorization code flow using a popup window.

## Usage

1. Properly polyfill [`URL`][1], [`URLSearchParams`][2] and [`fetch`][3], so that `fetch` can work with `URLSearchParams`-objects. `` only needs [`URLSearchParams`][2].
2. Set up your OAuth2 config properly (Client ID, Redirect URL, etc.)
3. Include the `oauth-authorizator` element on your page like this:
```html

```
4. Set up the `oauth-receiver` on the redirect page
```html

```
5. Call `oauth-authorizator.login()` at the appropriate time to start the authorization process. The access token will appear as observable property at `oauth-authorizator.accessToken` or will be available through the Promise's return value.

## Manual Mode

If you set the `manual`-attribute on ``, the element will not attempt to parse the parameters on page load. Instead, you will need to call `.receive()` in order to parse and send the OAuth get parameters. This could be useful if you want to show the user some content before redirecting back to the application.

## License
MIT

[1]: https://developer.mozilla.org/en-US/docs/Web/API/URL
[2]: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
[3]: https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch