This topic contains 1 reply, has 0 voices, and was last updated by CREECE 8 years, 4 months ago.
-
AuthorPosts
-
July 13, 2016 at 12:04 am #6658
CREECEI’ll preface this with everything works 100% fine when using e-mails without special characters. My plugin has been in the wild for a few months now and this is the first time I have seen this pop up.
Does NetSuite’s Roles Rest Service / WebServices prevent e-mails containing a “+” symbol (or most likely any special character)? For example, “test+login@testcompany.com”? I was able to change my NetSuite e-mail to contain a + and it worked fine but then trying to use that same e-mail / pass combination to do a simple GET request to the roles rest service via NLAuth header returns an error USER_ERROR, “You provided an invalid Authorization header.” The NLAuth would like like :
NLAuth nlauth_email=test+login@testcompany.com, nlauth_signature=
Oddly enough, my original e-mail PRIOR to changing it to contain a + symbol still works even though that is no longer the e-mail. The actual code that appears to be not working correctly is my NSRolesRestServiceController.java (https://github.com/Topher84/NetSuite…ontroller.java). The method buildNLAuthString takes whatever the user typed so I am not manipulating it in any means.
Thanks for any insight.
This is a cached copy. Click here to see the original post. -
July 13, 2016 at 8:49 pm #6659
CREECEI believe I have fixed the issue after some trial and error. When building the NLauth String, I encoding both the username and password in UTF-8 in order to take care of “special characters” and it let me login with a + in my e-mail.
Here’s the code (sorry about the weird formatting the code tags don’t do a great job at spacing it seems):
Code:
…
private final String UTF_8_ENCODING = “UTF-8”;
…
private String buildNLAuthString(String nsEmail, String nsPassword) {
try {
return “NLAuth nlauth_email=” + URLEncoder.encode(nsEmail, UTF_8_ENCODING) + “, nlauth_signature=” + URLEncoder.encode(nsPassword, UTF_8_ENCODING);
}
catch (Exception ex) {
return null;
}
}
Will put out a new version if anyone is using it or feel free to checkout the repo and use some of the code. -
AuthorPosts
You must be logged in to reply to this topic.