magiclabs / magic-admin-js

Magic admin Node.js SDK makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.
https://docs.magic.link/admin-sdk/node-js
MIT License
75 stars 33 forks source link

Encode url #21

Closed FYJen closed 4 years ago

FYJen commented 4 years ago

Admin sdk should encode the url to prevent non-conforming characters:

https://api.magic.link/v1/admin/auth/user/get?issuer=did:ethr:0xA093F00c775c0b7DF6E15355B039A9336A7Ff81E

The whole url should be encoded or the query parameter should be did:ethr:0xA093F00c775c0b7DF6E15355B039A9336A7Ff81E. The : has specific meaning in the url when it follows after the domain to specify the port number. I don't think it has any effect in the query string.

It is a good practice to encode the url particularly the one with special characters.

FYJen commented 4 years ago

@smithki: A minor improvement.

smithki commented 4 years ago

Easy fix, we will use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent

smithki commented 3 years ago

:rocket: Issue was released in v1.3.0 :rocket: