@@ -3,9 +3,9 @@ Authentication is done through [OAuth]. This library provides multiple [OAuth fl
33implementations for authentication. A client id can be obtained through a support
44ticket but this is planned to change in the near future. The client will first
55check if any tokens can be found in the cache before requiring authentication.
6- If one can be found the ` api.authenticate() ` method will instantly resolve without
6+ If one can be found the ` api.authenticate() ` method will instantly resolve without
77any side-effects. The variable ` api.authenticated ` will be set to true if a token
8- has been found and is still valid.
8+ has been found and is still valid.
99
1010Tokens are stored in HTTPS cookies if possible and using ` localStorage ` when the
1111browser is not using a HTTPS connection. [ Nodejs] uses a file named ` .m4n_token ` to store the token.
@@ -15,8 +15,8 @@ Multiple flows are supported for web browsers. All the web examples assume the w
1515build of the library has been included in the target page.
1616
1717### Implicit Flow
18- A client id is required to use the implicit flow. The redirect url * must* be the
19- same as the one linked to the client id. The callback url is automatically
18+ A client id is required to use the implicit flow. The redirect url * must* be the
19+ same as the one linked to the client id. The callback url is automatically
2020guessed if none is provided.
2121
2222``` js
@@ -25,22 +25,22 @@ var clientId = 1;
2525
2626// Callback url is set to the current url by default
2727var auth = new ImplicitFlow (clientId);
28- var api = new Maps4News (auth);
28+ var api = new Mapcreator (auth);
2929
3030// This will hijack the page if no authentication cache can
3131// be found. Smartest thing to do is to just let it happen
3232// and initialize any other code afterwards.
3333api .authenticate ().then (function () {
3434 // Save the token
3535 api .saveToken ();
36-
36+
3737 // Get the current user and dump the result to the console.
3838 api .users .get (' me' ).then (console .dir );
3939});
4040```
4141
4242### Implicit flow pop-up
43- Just like the Implicit Flow a client id is required.
43+ Just like the Implicit Flow a client id is required.
4444
4545``` js
4646// Obtained client id
@@ -53,23 +53,23 @@ var clientId = 1;
5353// a custom page that just contains `api.authenticate()`
5454// that uses ImplicitFlowPopup as the auth parameter.
5555var auth = new ImplicitFlowPopup (clientId);
56- var api = new Maps4News (auth);
56+ var api = new Mapcreator (auth);
5757
5858// This will create a pop-up window containing the log in
5959// page. Once the pop-up redirects back to the callback it
6060// will resolve the promise. The callback page should contain
6161api .authenticate ().then (function () {
6262 // Save the token
6363 api .saveToken ();
64-
64+
6565 // Get the current user and dump the result to the console.
6666 api .users .get (' me' ).then (console .dir );
6767});
6868```
6969
7070### Implicit flow pop-up (advanced)
7171Due to the nature of the implicit flow pop-up (referred to as IFP from now on)
72- method the callback page can be set to a blank page that just grabs the token
72+ method the callback page can be set to a blank page that just grabs the token
7373and then closes. This can be done in the following way.
7474
7575** index.html:**
@@ -79,13 +79,13 @@ var clientId = 1;
7979var callbackUrl = ' https://example.com/callback.html' ;
8080
8181var auth = new ImplicitFlowPopup (clientId);
82- var api = new Maps4News (auth);
82+ var api = new Mapcreator (auth);
8383
8484// This will resolve once the callback page has been loaded
8585api .authenticate ().then (function () {
8686 // Save the token
8787 api .saveToken ();
88-
88+
8989 // Get the current user and dump the result to the console.
9090 api .users .get (' me' ).then (console .dir );
9191});
@@ -101,8 +101,8 @@ new ImplicitFlowPopup(clientId);
101101```
102102
103103### Password flow (dangerous)
104- The password flow is ** NOT** intended to be used in the browser. If you do
105- decide to use the password flow then it is recommended to make sure that
104+ The password flow is ** NOT** intended to be used in the browser. If you do
105+ decide to use the password flow then it is recommended to make sure that
106106the site is ** NOT** public facing and using HTTPS. Leaking the [ secret] is
107107a very bad idea.
108108
@@ -115,7 +115,7 @@ var password = 'Password1!'; // password
115115// Secret will be leaked if this is used on a webpage. Please only use
116116// this for non-web applications.
117117var auth = new PasswordFlow (clientId, secret, username, password);
118- var api = new Maps4News (auth);
118+ var api = new Mapcreator (auth);
119119
120120// This will resolve once the authentication has completed
121121api .authenticate ().then (function () {
@@ -125,11 +125,11 @@ api.authenticate().then(function() {
125125```
126126
127127### Dummy flow
128- The dummy flow can be used when a token * should* be present in the cache.
128+ The dummy flow can be used when a token * should* be present in the cache.
129129
130130``` js
131131var auth = new DummyFlow ();
132- var api = new Maps4News (auth);
132+ var api = new Mapcreator (auth);
133133
134134// Manually check if we're logged in
135135if (api .authenticated ) {
@@ -160,7 +160,7 @@ var username = '
[email protected] '; // email is used for authentication
160160var password = ' Password1!' ; // password
161161
162162var auth = new PasswordFlow (clientId, secret, username, password);
163- var api = new Maps4News (auth);
163+ var api = new Mapcreator (auth);
164164
165165// This will resolve once the authentication has completed
166166api .authenticate ().then (function () {
@@ -174,7 +174,7 @@ The dummy flow can also be used when a token is known.
174174
175175``` js
176176var auth = new DummyFlow ();
177- var api = new Maps4News (auth);
177+ var api = new Mapcreator (auth);
178178
179179var token = {
180180 token: " eyJ0eXAiOiJKV1..." ,
0 commit comments