# Pass-in URL parameters with value to allow access?

**URL:** <https://discourse.nodered.org/t/pass-in-url-parameters-with-value-to-allow-access/40165>\
**Category:** General\
**Created:** [1 February 2021 11:40 UTC](https://discourse.nodered.org/t/pass-in-url-parameters-with-value-to-allow-access/40165 "2021-02-01T11:40:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![grawsom](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grawsom/32/53070_2.png) [@grawsom](https://discourse.nodered.org/u/grawsom)\
**Post date:** [1 February 2021 11:40 UTC](https://discourse.nodered.org/t/pass-in-url-parameters-with-value-to-allow-access/40165/1 "2021-02-01T11:40:09Z")

</div>

Hi there

Have made a solution where I send an URL to my node-red  
/my-testquery?value1=xxx&value2=yyy&value=zzz

How can I add a parameter eg. user=xyz so I can validate if the url is allowed to be processed?

Here is my testflow

```auto
[{"id":"b34dd1af.4cb23","type":"template","z":"a67755bf.66e9d8","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head></head>\n <body>\n <h1>Got you call</h1>\n </body>\n</html>","x":650,"y":120,"wires":[["b828f6a6.47d708","710c1ca9.1a4cc4"]]},{"id":"1052941d.efad6c","type":"http in","z":"a67755bf.66e9d8","name":"","url":"/my-testquery","method":"get","upload":false,"swaggerDoc":"","x":490,"y":120,"wires":[["b34dd1af.4cb23"]]},{"id":"b828f6a6.47d708","type":"http response","z":"a67755bf.66e9d8","name":"","statusCode":"","headers":{},"x":810,"y":120,"wires":[]},{"id":"710c1ca9.1a4cc4","type":"debug","z":"a67755bf.66e9d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"req.query","targetType":"msg","statusVal":"","statusType":"auto","x":840,"y":180,"wires":[]}]

```

And graficaly  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5ca979766a0f22595d5d287cc6f6af201c790a97.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 February 2021 13:33 UTC](https://discourse.nodered.org/t/pass-in-url-parameters-with-value-to-allow-access/40165/2 "2021-02-01T13:33:30Z")

</div>

Change the debug node to show Complete Message and see what is in there when the client asks for a url with parameters.

---

<div class="post-metadata">

**Author:** ![RaviKaushish](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ravikaushish/32/34137_2.png) [@RaviKaushish](https://discourse.nodered.org/u/RaviKaushish)\
**Post date:** [1 February 2021 18:16 UTC](https://discourse.nodered.org/t/pass-in-url-parameters-with-value-to-allow-access/40165/3 "2021-02-01T18:16:05Z")

</div>

@grawsom Hello!

From what I understand is that you want to add some functionality in your flow so that you can validate if the username passed in the URL is correct otherwise throw an error.

If that's what you're looking for then following flow is what you need.

```auto
[{"id":"3fabdbb9.f58784","type":"http in","z":"daf92697.d2de38","name":"","url":"/my-testquery","method":"get","upload":false,"swaggerDoc":"","x":130,"y":140,"wires":[["6039e16a.3fb0a"]]},{"id":"6bead8d3.0c0228","type":"http response","z":"daf92697.d2de38","name":"","statusCode":"200","headers":{},"x":720,"y":140,"wires":[]},{"id":"6039e16a.3fb0a","type":"switch","z":"daf92697.d2de38","name":"checking user","property":"req.query.user","propertyType":"msg","rules":[{"t":"eq","v":"grawsom","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":140,"wires":[["85de7b56.0fc468"],["d907eb5d.b51848"]]},{"id":"85de7b56.0fc468","type":"template","z":"daf92697.d2de38","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head></head>\n <body>\n <h1>Got you call</h1>\n </body>\n</html>","x":550,"y":140,"wires":[["6bead8d3.0c0228"]]},{"id":"11494205.16065e","type":"http response","z":"daf92697.d2de38","name":"","statusCode":"401","headers":{},"x":720,"y":180,"wires":[]},{"id":"d907eb5d.b51848","type":"function","z":"daf92697.d2de38","name":"","func":"msg.payload =`You're not authorized`\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":180,"wires":[["11494205.16065e"]]}]

```

Best,  
-Ravi

---

<div class="post-metadata">

**Author:** ![grawsom](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grawsom/32/53070_2.png) [@grawsom](https://discourse.nodered.org/u/grawsom)\
**Post date:** [1 February 2021 20:03 UTC](https://discourse.nodered.org/t/pass-in-url-parameters-with-value-to-allow-access/40165/4 "2021-02-01T20:03:49Z")

</div>

@RaviKaushish -just what I was looking for, learning new stuff all the time

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 February 2021 20:04 UTC](https://discourse.nodered.org/t/pass-in-url-parameters-with-value-to-allow-access/40165/5 "2021-02-15T20:04:33Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
