Skip to content

Instantly share code, notes, and snippets.

@dexterlabora
Last active March 25, 2019 10:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dexterlabora/bc9f3d9f02a898e3368ea48246f5006d to your computer and use it in GitHub Desktop.
Save dexterlabora/bc9f3d9f02a898e3368ea48246f5006d to your computer and use it in GitHub Desktop.
Cisco Meraki and Spark Demo Flows

A collection of flows to demonstrate several Cisco APIs for Meraki and Spark.

Flows

  • Meraki Scanning API
  • Meraki Captive Portal API
  • Meraki Dashboard API
  • Spark API

Usage

Each flow demonstrates the core mechanics of the API, which is ideal for beginning any project. The Info window for each flow will include a more detail overview along with instructions for configurations.

It is expected that you have a Cisco Meraki network and a Cisco Spark developer account to make use of these flows.

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2019 Cory Guynn
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file has been truncated, but you can view the full file.
[{"id":"677ea62c.d4fe48","type":"tab","label":"Location API","disabled":false,"info":"# Meraki Location Scanning API \n\nThis flow demonstrates the basic mechanics of\nthe Scanning API web service. It will provide\ntwo API endpoints to interact with the Meraki API.\n\n`[get] /scanning`\nResponds to Meraki with the `validator` to \nvalidate the receiver.\n\n`[post] /scanning`\nReceives observation data from a Meraki AP. \nThe data is compared against the `secret` to\nvalidate the sender.\n\nA **link** node is then used to demonstrate how the\ndata can be analyzed and routed. \n\nIt is now up to you to do something awesome with\nthis information. Add a map, database or IoT\ncontrol...\n\nhttp://developers.meraki.com\nhttp://www.InternetOfLEGO.com\n\n"},{"id":"ad289f82.1f3ed","type":"tab","label":"Captive Portal","disabled":false,"info":"# Meraki External Captive Portal (ExCap)\n\nThis flow demonstrates the mechanics of working\nwith the Meraki Captive Portal API. \n\nThere are two \"Splash Page\" types with Meraki, \n**Click-through** and **Sign on**.\n\nThere are two flows to highlight the differences\nbut they may share common assets, such as a ToS.\n\n# Overview\n\n## Click-through\nThe click-through splash page simply expects\nto receive a request from Meraki which includes\nthe parameters of the authenticating client. It\nwill then parse the parameters, present a splash\npage and eventually redirect the client to \nthe `base_grant_url` once the form is submitted\n\n`[get] /excapClick`\nThe path Meraki will use as the **Custom Splash \nURL**\nThe client will see the splash page, which is \nprovided by the **HTML (template)** node.\n\n`[post] /excapClickLogin`\nThe URL that will be the web form's \"Action\".\nIt will then send the user form data to the flow\nand redirect the client to the `base_grant_url`.\n\n\n## Sign On\n\n`[get] /excapSignOn`\nThe path Meraki will use as the **Custom Splash\nURL**\nThe client will see the splash page, which is \nprovided by the **HTML (template)** node.\nThe form will include a Meraki provided `login_url`, which will\nbe set as the \"Action\" on the web form.\n\n`[post] /excapSuccess`\nThis path Meraki will use as the continue_url\nfor the client once they have succesfully logged\nin. Use this to have a final interaction with the\nclient.\n\n\n# Usage\n\nLogin to Meraki Dashboard and configure the \ncustom Splash Page URL to one of these methods.\n* http://yourserver:1880/excapClick\n* http://yourserver:1880/excapSignOn\n\nIf using Sign On, you must also configure WiFi \nUser accounts that are authorized for the SSID.\n\n# More Info\n\nhttps://meraki.cisco.com/lib/pdf/meraki_whitepaper_captive_portal.pdf\nhttp://developers.meraki.com\nhttp://www.InternetOfLEGO.com\n\n\n"},{"id":"df4cef7b.9e8a6","type":"tab","label":"Dashboard API - Admin Form","disabled":false,"info":"# Dashboard API - Admin Form\nA flow to create and administrator for a\nMeraki network. \n\n## Configure\n* Update the Environment Variables node\n**Env Variables: UPDATE THIS**\n\nYour API KEY (Keep this secret. Do not publish)\n```\nconst API_KEY = 'YourAPIKey'; \n```\n\nYour Shard number. https://n149.meraki.com , \nwhere n149 represent the shard number. \nYou can see this URL when you login to your Meraki Dashboard.\nThis is defined to avoid redirect issues.\n```\nvar shard = 'n149'; \n```\nYour Default Organization ID (optional)\n```\nvar orgId = ''; \n```\n\n# Usage\n\n`[get /meraki/admins]`\nPresents the web form.\n\nNavigate to\n* http://localhost:1880/meraki/admins\n\n\n# Verify\nIf the user was created properly, the web page\nwill display the committed details. You can\nverify the account in the Meraki Dashboard\n\n# More Info\n\nhttp://developers.meraki.com\nhttp://www.InternetOfLEGO.com\n\n\n\n\n\n\n\n\n\nThis flow can be adjusted to\nleaverage the many other API endpoints available.\n"},{"id":"2a0bfedb.19a932","type":"tab","label":"Cisco Spark","disabled":false,"info":"# Cisco Spark API Demo\nCollects data from **input** nodes and sends it\nto a Spark room.\n\n# Configure\nUpdate the **function** node \"Spark Send Message (API) - UPDATE\"\n* Set Your Variables\n**Your Access Token**\n```\nvar accessToken = \"EnterYourAccessTokenHere\";\n```\n**Your Room ID**\n```\nvar roomId = \"EnterYourRoomIDHere\";\n```\n\n# Usage\nThe link nodes from other flows can be sent to \nthe \"Cisco Spark\" **link in* node. As messages\narrive, they will be sent to the Spark room. The\nmessages will typically be formatted before sending\nto adjust for the Spark message room layout.\n\n# More Info\n\nLearn about getting an accessToken and using their \nonline API console to obtain the roomId.\nhttps://developer.ciscospark.com/\n\nhttps://developer.ciscospark.com/"},{"id":"b8bba6c6.bce9a8","type":"debug","z":"677ea62c.d4fe48","name":"scanning Data","active":true,"console":"false","complete":"true","x":620,"y":260,"wires":[]},{"id":"57a8733a.3c233c","type":"http in","z":"677ea62c.d4fe48","name":"","url":"/scanning","method":"get","upload":false,"swaggerDoc":"","x":120,"y":120,"wires":[["1c20f2f8.bd123d","66409674.4d78a8"]]},{"id":"1c20f2f8.bd123d","type":"function","z":"677ea62c.d4fe48","name":"validate-validator - UPDATE","func":"\n//Set the validator variable to match the Meraki network\n//The URL will not need to include the validator string, for enhanced security\n//~~~~~~~~~\nvalidator = \"yourValidatorKey\";\n\n// For testing purposes:\n// This validator accepts a message with the validator defined in the URL\n// Example: http://yourserver:1880/cmx?validator=8e0846499d9a3f6d23f7bogusd55b9d6325035f5\n\n//~~~~~~~~~\n//validator = msg.payload.validator;\n\n\nmsg.payload = validator;\nreturn msg;","outputs":1,"noerr":0,"x":360,"y":120,"wires":[["43c770fa.58d81","77f86e16.e7509"]]},{"id":"43c770fa.58d81","type":"http response","z":"677ea62c.d4fe48","name":"scanning response","statusCode":"","headers":{},"x":610,"y":120,"wires":[]},{"id":"66409674.4d78a8","type":"debug","z":"677ea62c.d4fe48","name":"scanning validator raw","active":true,"console":"false","complete":"payload","x":340,"y":160,"wires":[]},{"id":"d4e4132e.b05ed","type":"comment","z":"677ea62c.d4fe48","name":"Location API core mechanics","info":"CMX/Location API core functions","x":140,"y":80,"wires":[]},{"id":"77f86e16.e7509","type":"debug","z":"677ea62c.d4fe48","name":"scanning Validator","active":true,"console":"false","complete":"payload","x":610,"y":160,"wires":[]},{"id":"281beb10.b703a4","type":"function","z":"677ea62c.d4fe48","name":"validate-secret - UPDATE","func":"// This node verifies that the secrect configured\n// on the Meraki Dashboard Network, matches.\n//var secret = \"merakilous\"; \nvar secret = \"supersecret\";\n\nif(msg.payload.secret == secret){\n return msg;\n}else{\n // Secret is invalid\n \n}\n\n","outputs":1,"noerr":0,"x":350,"y":220,"wires":[["b8bba6c6.bce9a8","be58f84f.5d0bc8","dff10141.0795e"]]},{"id":"78fb178.88f0ae8","type":"debug","z":"677ea62c.d4fe48","name":"scanning post","active":false,"console":"false","complete":"payload","x":320,"y":260,"wires":[]},{"id":"be58f84f.5d0bc8","type":"http response","z":"677ea62c.d4fe48","name":"cmx response","x":600,"y":220,"wires":[]},{"id":"c188b3e0.8cf98","type":"comment","z":"677ea62c.d4fe48","name":"Meraki Location API - Using Native Nodes -- README","info":"This flow demonstrates how to interact with the\nMeraki CMX (Scanning) Location API.\n\n# Be sure to update the validator and secret\n\nThe \"CMX core functions\" consist of two REST endpoints.\nThe 'get' enpoint waits to hear from Meraki,\nwhich will send a request to this server. The flow will \nthen respond with the \"validator\", which was defined in \nthe Meraki Dashboard. If the correct validator is returned, \nMeraki has confirmed that it is sending location data to \nthe correct server.\n\nThe second enpoint accepts 'post' requests, which will\nbe receiving the JSON structured location data from Meraki.\n\nOnce the data has arrived in the `msg.payload`, the results\nwill be stored in a local MongoDB database if the supplied secret\nmatches what's defined in the global variables. This is to ensure\nthat it is in fact Meraki sending this data. \n\nThe data can then be retrieved by opening the other 'get' endpoints, such \nas /showcmxNative.\n\n","x":461,"y":27,"wires":[]},{"id":"785d08d9.f64b88","type":"debug","z":"ad289f82.1f3ed","name":"excapSignOn raw data","active":true,"console":"false","complete":"payload","x":200,"y":480,"wires":[]},{"id":"34da95b.df9996a","type":"http in","z":"ad289f82.1f3ed","name":"","url":"/excapSignOn","method":"get","swaggerDoc":"","x":150,"y":440,"wires":[["785d08d9.f64b88","6473d59c.1930cc"]]},{"id":"65701c35.2be8d4","type":"http response","z":"ad289f82.1f3ed","name":"","x":770,"y":160,"wires":[]},{"id":"a9d9b12.51e395","type":"http in","z":"ad289f82.1f3ed","name":"","url":"/excapClick","method":"get","swaggerDoc":"","x":140,"y":120,"wires":[["50a65a91.2cbdc4","f6542a67.63cfa8"]]},{"id":"de9b1754.8c32e8","type":"http response","z":"ad289f82.1f3ed","name":"","x":770,"y":480,"wires":[]},{"id":"8ca6d108.2de8c","type":"template","z":"ad289f82.1f3ed","name":"HTML Login Page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html>\n<head>\n{{{payload.css}}}\n\n\n <meta charset=\"utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n <title>Registration Form</title>\n\n</head>\n<body>\n\n \n\n\n <div class=\"main-content\">\n <form class=\"form-register\" method=POST action={{payload.login_url}} />\n <input type=\"hidden\" name=\"continue_url\" value={{payload.continue_url}} />\n <input type=\"hidden\" name=\"host\" value ={{host}}>\n <input type=\"hidden\" name=\"base_grant_url\" value = {{payload.base_grant_url}}/>\n <input type=\"hidden\" name=\"user_continue_url\" value = {{payload.user_continue_url}}/>\n <input type=\"hidden\" name=\"node_mac\" value = {{payload.node_mac}}/>\n <input type=\"hidden\" name=\"client_ip\" value = {{payload.client_ip}}/>\n <input type=\"hidden\" name=\"client_mac\" value = {{payload.client_mac}}/>\n <input type=\"hidden\" name=\"success_url\" value={{payload.continue_url}} />\n\n <div class=\"form-register-with-email\">\n\n <div class=\"form-white-background\">\n\n <div class=\"form-title-row\">\n <h1>Login to WiFi</h1>\n </div>\n\n <div class=\"form-row\">\n <label>\n <span>Email</span>\n <input type=\"email\" name=\"email\" required>\n </label>\n </div>\n\n <div class=\"form-row\">\n <label>\n <span>Password</span>\n <input type=\"password\" name=\"password\" required>\n </label>\n </div>\n\n <div class=\"form-row\">\n <label class=\"form-checkbox\">\n <input type=\"checkbox\" name=\"checkbox\" checked value=\"accepted\" required>\n <span>I agree to the <a href=\"/excapTerms\" target\"_blank\">terms and conditions</a></span>\n </label>\n </div>\n\n <div class=\"form-row\">\n <button type=\"submit\">Register</button>\n </div>\n\n </div>\n\n </div>\n\n <!-- Future Social Features\n <div class=\"form-sign-in-with-social\">\n\n <div class=\"form-row form-title-row\">\n <span class=\"form-title\">Sign in with</span>\n </div>\n\n <a href=\"#\" class=\"form-google-button\">Google</a>\n <a href=\"#\" class=\"form-facebook-button\">Facebook</a>\n <a href=\"#\" class=\"form-twitter-button\">Twitter</a>\n \n\n </div>\n -->\n\n </form>\n Your IP: {{payload.client_ip}}\n <br>\n Your MAC: {{payload.client_mac}}\n\n </div>\n\n</body>\n\n</html>","x":570,"y":480,"wires":[["de9b1754.8c32e8"]]},{"id":"50a65a91.2cbdc4","type":"function","z":"ad289f82.1f3ed","name":"Set login_url","func":"msg.payload.login_url = msg.payload.base_grant_url + '?continue_url=' + msg.payload.user_continue_url;\n\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":120,"wires":[["e8df823a.91a29"]]},{"id":"f6542a67.63cfa8","type":"debug","z":"ad289f82.1f3ed","name":"excapClick raw data","active":true,"console":"false","complete":"payload","x":200,"y":160,"wires":[]},{"id":"77600c5c.923134","type":"comment","z":"ad289f82.1f3ed","name":"Meraki Click-through, read more...","info":"Configure by placing this host server address\nfollowed by /excapClick in the Custom Splash Page URL\nsection of the Meraki Dashboard.\n\nie. https://yourserver:1880/excapClick\n\nBe sure to update the \"walled garden\" in the \nMeraki Dashboard with the IP address of your \nserver and any other resources required before\nlogin, such as your website, images, CSS, etc.\n\nThe HTML page can be modified as needed. \n","x":173,"y":79,"wires":[]},{"id":"a7287d8c.0b3f7","type":"comment","z":"ad289f82.1f3ed","name":"Meraki Sign-on, read more...","info":"Configure by placing this host server address\nfollowed by /excapClick in the Custom Splash Page URL\nsection of the Meraki Dashboard.\n\nie. https://yourserver:1880/excapSignOn\n\nBe sure to update the \"walled garden\" in the \nMeraki Dashboard with the IP address of your \nserver and any other resources required before\nlogin, such as your website, images, CSS, etc.\n\n","x":159,"y":396,"wires":[]},{"id":"56cef44d.b819fc","type":"template","z":"ad289f82.1f3ed","name":"HTML Splash Page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html>\n<head>\n{{{payload.css}}}\n\n\n\t<meta charset=\"utf-8\">\n\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n\t<title>Registration Form</title>\n\n</head>\n<body>\n\n\t\n\n\n <div class=\"main-content\">\n\n <form class=\"form-register\" method=POST action=\"/excapClickLogin\">\n <input type=\"hidden\" name=\"continue_url\" value={{payload.continue_url}} />\n <input type=\"hidden\" name=\"host\" value ={{host}}>\n <input type=\"hidden\" name=\"base_grant_url\" value = {{payload.base_grant_url}}/>\n <input type=\"hidden\" name=\"user_continue_url\" value = {{payload.user_continue_url}}/>\n <input type=\"hidden\" name=\"node_mac\" value = {{payload.node_mac}}/>\n <input type=\"hidden\" name=\"client_ip\" value = {{payload.client_ip}}/>\n <input type=\"hidden\" name=\"client_mac\" value = {{payload.client_mac}}/>\n \n <div class=\"form-register-with-email\">\n\n <div class=\"form-white-background\">\n\n <div class=\"form-title-row\">\n <h1>Login to WiFi</h1>\n </div>\n\n <div class=\"form-row\">\n <label>\n <span>Name</span>\n <input type=\"text\" name=\"name\" required>\n </label>\n </div>\n\n <div class=\"form-row\">\n <label>\n <span>Email</span>\n <input type=\"email\" name=\"email\" required>\n </label>\n </div>\n\n <div class=\"form-row\">\n <label class=\"form-checkbox\">\n <input type=\"checkbox\" name=\"checkbox\" checked value=\"accepted\" required>\n <span>I agree to the <a href=\"/excapTerms\" target\"_blank\">terms and conditions</a></span>\n </label>\n </div>\n\n <div class=\"form-row\">\n <button type=\"submit\">Register</button>\n </div>\n\n </div>\n\n </div>\n\n <!-- Future Social Features\n <div class=\"form-sign-in-with-social\">\n\n <div class=\"form-row form-title-row\">\n <span class=\"form-title\">Sign in with</span>\n </div>\n\n <a href=\"#\" class=\"form-google-button\">Google</a>\n <a href=\"#\" class=\"form-facebook-button\">Facebook</a>\n <a href=\"#\" class=\"form-twitter-button\">Twitter</a>\n \n\n </div>\n -->\n\n </form>\n Your IP: {{payload.client_ip}}\n <br>\n Your MAC: {{payload.client_mac}}\n\n </div>\n\n</body>\n\n</html>\n\n","x":570,"y":160,"wires":[["65701c35.2be8d4"]]},{"id":"458d3034.3cab1","type":"http in","z":"ad289f82.1f3ed","name":"","url":"/excapClickLogin","method":"post","swaggerDoc":"","x":160,"y":220,"wires":[["bf6360ac.edf2f","1bb67572.8b7f0b","33ed0e9b.30d802"]]},{"id":"bf6360ac.edf2f","type":"function","z":"ad289f82.1f3ed","name":"Process login with 302 redirect","func":"// check if client has connected properly and received response from AP\nif (msg.payload.base_grant_url){\n msg.statusCode = 302;\n msg.headers = {\n 'Location': msg.payload.base_grant_url + '?continue_url=' + msg.payload.user_continue_url\n //add other headers here...\n };\n}else{\n // error: send client back to login\n msg.statusCode = 302;\n msg.headers = {\n 'Location': '/excapNotConnected'\n //add other headers here...\n };\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":220,"wires":[["b398ae98.80f2","dedaeb10.4019b8"]]},{"id":"b398ae98.80f2","type":"http response","z":"ad289f82.1f3ed","name":"","x":770,"y":220,"wires":[]},{"id":"1bb67572.8b7f0b","type":"debug","z":"ad289f82.1f3ed","name":"excapClick Login data","active":true,"console":"false","complete":"payload","x":200,"y":260,"wires":[]},{"id":"d07099d5.ea4b78","type":"comment","z":"ad289f82.1f3ed","name":"Store form data - read more...","info":"The login data now can be sent somehwere to be \nlogged. A link node is attached to easily use\nthis data in other parts of the flow.","x":500,"y":260,"wires":[]},{"id":"c912801f.475bc","type":"comment","z":"ad289f82.1f3ed","name":"Terms and Conditions","info":"","x":144,"y":750,"wires":[]},{"id":"d2e63925.ee6138","type":"comment","z":"ad289f82.1f3ed","name":"Success","info":"","x":106,"y":538,"wires":[]},{"id":"90642ce8.4089c","type":"http in","z":"ad289f82.1f3ed","name":"","url":"/excapTerms","method":"get","swaggerDoc":"","x":150,"y":800,"wires":[["ee81bdad.d7fb6"]]},{"id":"99ce6c82.9919b","type":"http response","z":"ad289f82.1f3ed","name":"","x":790,"y":840,"wires":[]},{"id":"70a86349.0fce0c","type":"template","z":"ad289f82.1f3ed","name":"HTML Terms and Conditions","field":"payload","format":"handlebars","template":"<head>\n <title>Terms and Conditions</title>\n{{{payload}}}\n</head>\n<body>\n <div class=\"container\">\n <h1>Terms and Conditions</h1>\n <ul>\n <li>Please use our network responsibly. </li>\n <li>Your computer's MAC and IP address will be logged.</li>\n </ul>\n </div>\n</body>\n\n\n","x":600,"y":840,"wires":[["99ce6c82.9919b"]]},{"id":"ab45d396.4b0c3","type":"http in","z":"ad289f82.1f3ed","name":"","url":"/excapSuccess","method":"get","swaggerDoc":"","x":150,"y":580,"wires":[["5edcbfb5.54958"]]},{"id":"53f0d212.921d5c","type":"http response","z":"ad289f82.1f3ed","name":"","x":790,"y":620,"wires":[]},{"id":"92561f5a.4c3a","type":"template","z":"ad289f82.1f3ed","name":"HTML Success","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<head>\n <title>Success!</title>\n{{{payload.css}}}\n</head>\n<body>\n <div class=\"container\">\n <center><h1>Success!</h1>\n <h2>You can now use the network.</h2>\n </center>\n </div>\n</body>\n\n\n","x":560,"y":620,"wires":[["53f0d212.921d5c"]]},{"id":"cfad1722.d9ae98","type":"comment","z":"ad289f82.1f3ed","name":"Error: Not connected to AP","info":"","x":160,"y":873,"wires":[]},{"id":"76363ad4.c8b6f4","type":"http in","z":"ad289f82.1f3ed","name":"","url":"/excapNotConnected","method":"get","swaggerDoc":"","x":170,"y":920,"wires":[["d6875b72.b0d4e8"]]},{"id":"a795eff5.4ed3","type":"http response","z":"ad289f82.1f3ed","name":"","x":790,"y":960,"wires":[]},{"id":"a00bfbd.6120608","type":"template","z":"ad289f82.1f3ed","name":"HTML Terms and Conditions","field":"payload","format":"handlebars","template":"<head>\n <title>Error: Not Connected</title>\n{{{payload}}}\n</head>\n<body>\n <div class=\"container\">\n <h1>Error: Not Connected</h1>\n <p>\n Hmm, somethings not right. It appears you\n are not connected to the correct wireless network.\n </p>\n </div>\n</body>\n\n\n","x":600,"y":960,"wires":[["a795eff5.4ed3"]]},{"id":"54c6abe3.5ef6b4","type":"comment","z":"ad289f82.1f3ed","name":"Cisco Meraki ExCap Service","info":"More information about the Meraki ExCap API:\nhttps://meraki.cisco.com/lib/pdf/meraki_whitepaper_captive_portal.pdf\n\nEnjoy!\n\nWritten by Cory Guynn, 2015.\nConsulting Engineer @ https://meraki.cisco.com/\nTechnical Blogger @ http://www.InternetOfLego.com","x":438.5,"y":31,"wires":[]},{"id":"e8df823a.91a29","type":"template","z":"ad289f82.1f3ed","name":"CSS Style","field":"payload.css","fieldType":"msg","format":"html","syntax":"mustache","template":"<style>\nhtml{\n background-color: #f3f3f3;\n}\n\n.form-register{\n max-width: 1000px;\n width: 100%;\n margin: 0 auto;\n\n font: bold 14px sans-serif;\n text-align: center;\n}\n\n.form-register-with-email{\n position: relative;\n display: inline-block;\n vertical-align: top;\n margin-right: 130px;\n text-align: center;\n}\n\n.form-register-with-email .form-white-background{\n width: 570px;\n box-sizing: border-box;\n background-color: #ffffff;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);\n padding: 60px 80px;\n margin-bottom: 35px;\n}\n\n.form-register-with-email .form-row{\n text-align: left;\n margin-bottom: 23px;\n}\n\n.form-register-with-email .form-title-row{\n text-align: center;\n margin-bottom: 50px;\n}\n\n.form-register-with-email h1{\n display: inline-block;\n box-sizing: border-box;\n color: #4c565e;\n font-size: 24px;\n padding: 0 20px 15px;\n border-bottom: 2px solid #6caee0;\n margin: 0;\n}\n\n.form-register-with-email .form-row > label span{\n display: inline-block;\n box-sizing: border-box;\n color: #5f5f5f;\n width: 125px;\n text-align: right;\n padding-right: 25px;\n}\n\n.form-register-with-email input{\n color: #5f5f5f;\n box-sizing: border-box;\n width: 230px;\n box-shadow: 1px 2px 4px 0 rgba(0, 0, 0, 0.08);\n padding: 12px 18px;\n border: 1px solid #dbdbdb;\n}\n\n.form-register-with-email .form-checkbox input{\n margin-left: 128px;\n margin-right: 10px;\n width: auto;\n vertical-align: top;\n}\n\n.form-register-with-email .form-row .form-checkbox span{\n font-size: 12px;\n font-weight: normal;\n display: inline-block;\n text-align: left;\n width: 220px;\n margin: 0;\n}\n\n.form-register-with-email .form-checkbox span a{\n text-decoration: none;\n color: #6caee0;\n}\n\n.form-register-with-email button{\n display: block;\n border-radius: 2px;\n background-color: #6caee0;\n color: #ffffff;\n font-weight: bold;\n box-shadow: 1px 2px 4px 0 rgba(0, 0, 0, 0.08);\n padding: 15px 35px;\n border: 0;\n margin: 55px auto 0;\n cursor: pointer;\n}\n\n.form-register-with-email .form-log-in-with-existing{\n text-decoration: none;\n padding: 4px 8px;\n font-weight: normal;\n color: #7b9d62;\n background-color: #d6f0c3;\n}\n\n\n.form-sign-in-with-social{\n display: inline-block;\n max-width: 180px;\n box-sizing: border-box;\n vertical-align: top;\n text-align: center;\n margin-top: 100px;\n}\n\n.form-sign-in-with-social .form-title-row{\n margin-bottom: 50px;\n}\n\n.form-sign-in-with-social .form-title{\n box-sizing: border-box;\n color: #4c565e;\n font-size: 24px;\n padding: 15px 20px;\n border-bottom: 2px solid #6caee0;\n}\n\n.form-sign-in-with-social .form-google-button{\n color: #ffffff;\n display: block;\n width: 145px;\n height: 40px;\n font-size: 12px;\n line-height: 40px;\n background-color: rgba(222, 110, 60, 0.9);\n box-shadow: 1px 2px 2px 0 rgba(0, 0, 0, 0.08);\n border-radius: 2px;\n margin: 8px auto;\n text-decoration: none;\n}\n\n.form-sign-in-with-social .form-facebook-button{\n color: #ffffff;\n display: block;\n width: 145px;\n height: 40px;\n font-size: 12px;\n line-height: 40px;\n background-color: rgba(75, 136, 194, 0.9);\n box-shadow: 1px 2px 2px 0 rgba(0, 0, 0, 0.08);\n border-radius: 2px;\n margin: 8px auto;\n text-decoration: none;\n}\n\n.form-sign-in-with-social .form-twitter-button{\n color: #ffffff;\n display: block;\n width: 145px;\n height: 40px;\n font-size: 12px;\n line-height: 40px;\n background-color: rgba(123, 195,
@nconder
Copy link

nconder commented Aug 15, 2017

Can you please list all the Node-Red dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment