Skip to content

Commit ef80dc6

Browse files
committed
🔥 Remove polyfills
These are better done by the application using the elements.
1 parent ecd817f commit ef80dc6

6 files changed

+10
-15
lines changed

README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ A Polymer 2.0 Element that performs the OAuth2 authorization code flow using a p
44

55
## Usage
66

7-
1. Set up your OAuth2 config properly (Client ID, Redirect URL, etc.)
8-
2. Include the `oauth-authorizator` element on your page like this:
7+
1. Properly polyfill [`URL`][1], [`URLSearchParams`][2] and [`fetch`][3], so that `fetch` can work with `URLSearchParams`-objects. `<oauth-receiver>` only needs [`URLSearchParams`][2].
8+
2. Set up your OAuth2 config properly (Client ID, Redirect URL, etc.)
9+
3. Include the `oauth-authorizator` element on your page like this:
910
```html
1011
<oauth-authorizator access-token="{{yourAccessToken}}"
1112
authorization-url="The URL that will be loaded in the popup window, e.g. https://accounts.spotify.com/authorize"
@@ -16,15 +17,19 @@ A Polymer 2.0 Element that performs the OAuth2 authorization code flow using a p
1617
token-refresh-url="The URL where your token refresh server is located">
1718
</oauth-authorizator>
1819
```
19-
3. Set up the `oauth-receiver` on the redirect page
20+
4. Set up the `oauth-receiver` on the redirect page
2021
```html
2122
<oauth-receiver target="Optional, the site you're hosting your website on. E.g. https://festify.us"></oauth-receiver>
2223
```
23-
4. 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.
24+
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.
2425

2526
## Manual Mode
2627

2728
If you set the `manual`-attribute on `<oauth-receiver>`, the element will not attempt to parse the parameters on page load. Instead, you will need to call `<oauth-receiver>.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.
2829

2930
## License
3031
MIT
32+
33+
[1]: https://developer.mozilla.org/en-US/docs/Web/API/URL
34+
[2]: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
35+
[3]: https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch

bower.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
"description": "A Polymer 2.0 Element that performs the OAuth2 authorization code flow",
44
"main": "oauth-authorizator.html",
55
"dependencies": {
6-
"fetch-import": "^1.0.0",
7-
"polymer": "Polymer/polymer#^2.0.0",
8-
"url": "webcomponents/URL#^0.5.7",
9-
"url-search-params": "^0.9.0"
6+
"polymer": "Polymer/polymer#^2.0.0"
107
},
118
"devDependencies": {
129
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^2.0.0",

oauth-authorizator.html

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<link rel="import" href="../polymer/polymer-element.html">
2-
<link rel="import" href="url-search-params-polyfill.html"> <!-- Must come before fetch polyfill -->
3-
<link rel="import" href="../fetch-import/fetch.html">
4-
<link rel="import" href="url-polyfill.html">
52

63
<script>
74
/**

oauth-receiver.html

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<link rel="import" href="url-search-params-polyfill.html">
2-
31
<script>
42
/**
53
* `oauth-receiver`

url-polyfill.html

-1
This file was deleted.

url-search-params-polyfill.html

-1
This file was deleted.

0 commit comments

Comments
 (0)