So, I am trying to generate a redirect_uri to brin...
# suitescript
t
So, I am trying to generate a redirect_uri to bring a person back to the page that it was originally at. When using
url.resolveDomain()
it returns the wrong user id. I am getting the user id for another account that I can switch to. I have a development account and a testing account, when I'm on the testing account, it still generates the user id of the development account
b
I don't know why you are getting weird results from resolveDomain
but you should be able to redirect using a relative path
you don't actually need the domain
t
Does that work in the redirect_uri for authentication?
I am getting a right domain back, it's just not for the account I'm logged in to, but for the one that I made the script with
It might be something to do with subsidiary of my user? But I have no clue
That was the one that said to try to use resolveDomain, but I might try the method he suggested
That doesn't work either
b
what are you trying to redirect to
t
I am doing token based authentication, and I need to build the redirect url dynamically
b
I still don't know what this is
normally you don't do authentication when you redirect in NetSuite
the normal thing is you redirect to a page in the current account
that requires no authentication
and usually does not require knowing the domain at all
t
I am redirecting to an external login to get a token. Once I get the token, I need to redirect to a page in netsuite, needing the whole url
The issue I'm having is generating that, if I hard code the url it works, but I can't seem to get it working with another account I have access to
b
this sounds like oauth2
t
Yup that's what it is
Forgot the name, that's my bad lol
b
and the url you need to generate is not actually used in NetSuite as the redirect
t
No, it is being used in the redirect_uri field of the request for the token
b
if its not used by NetSuite, you can't use relative urls
that said, what does your resolveDomain look like?
t
It looks correct. It is
<http://account1.app.netsuite.com|account1.app.netsuite.com>
, but when I try to do it with account2, it asks me to login, and sending me back to account1
Might have figured out the issue
It looks like the redirect is being set in another place.