Skip to content

Commit bda9283

Browse files
committed
update README with runtime configuration docs
1 parent 7cb1dbb commit bda9283

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you're using `bower` they will be automatically downloaded upon installing th
3131
<script src="<VENDOR_FOLDER>/angular-oauth2/dist/angular-oauth2.min.js"></script>
3232
```
3333

34-
###### 3. Configure `OAuth` (required) and `OAuthToken` (optional):
34+
###### 3. Configure `OAuth` (optional) and `OAuthToken` (optional):
3535

3636
```js
3737
angular.module('myApp', ['angular-oauth2'])
@@ -44,7 +44,18 @@ angular.module('myApp', ['angular-oauth2'])
4444
}]);
4545
```
4646

47-
ps: You can also configure service at runtime, in case you retrieve oauth server configuration from a ajax request.
47+
You can also configure `OAuth` service in a `.run()`block, in case you retrieve the Oauth server configuration from a ajax request.
48+
49+
```js
50+
angular.module('myApp', ['angular-oauth2'])
51+
.run(['OAuth', function(OAuth) {
52+
OAuth.configure({
53+
baseUrl: 'https://api.website.com',
54+
clientId: 'CLIENT_ID',
55+
clientSecret: 'CLIENT_SECRET' // optional
56+
});
57+
}]);
58+
```
4859

4960
###### 4. Catch `OAuth` errors and do something with them (optional):
5061

0 commit comments

Comments
 (0)