0

I could get access token and secret, but they are not working some times . I am getting error like invalid login attempt. I don't know how to solve this issue.

I have all the credentials for oauth , these are

  1. Consumer key
  2. Consumer secret
  3. Account id
  4. Token id
  5. Token Secret
  6. Script id
  7. Deployment id

I want to know my oauth credentials by group or individual are valid or not .

Prabhu
  • 783
  • 2
  • 10
  • 35

1 Answers1

1

I think the only way is to hit SuiteTalk or RESTlet.

If you are using RESTlet, you must ensure that the user has access to RESTlet in the deployment options.

I have a working code using Java (using Scribe Java Library) which can be found here

MAIN Method:

OAuthConfig authConfig = new OAuthConfig("CONSUMER_KEY", "CONSUMER_SECRET", null, SignatureType.Header, null, null);
    Token token = new Token("TOKEN_ID", "TOKEN_SECRET");
    OAuth10aServiceImpl auth10aServiceImpl = new OAuth10aServiceImpl(new NetSuiteApi(), authConfig);
    OAuthRequest request = new OAuthRequest(Verb.GET, "RESTLET_URL");
    request.setRealm("NS_ACCOUNT_ID");
    auth10aServiceImpl.signRequest(token, request);
    Response response = request.send();

Also you will need to write NetSuiteApi Class extending DefaultApi10a

import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.Token;

public class NetSuiteApi extends DefaultApi10a {

@Override
public String getAccessTokenEndpoint() {
    // TODO Auto-generated method stub
    return null;
}

@Override
public String getAuthorizationUrl(Token arg0) {
    // TODO Auto-generated method stub
    return null;
}

@Override
public String getRequestTokenEndpoint() {
    // TODO Auto-generated method stub
    return null;
}

}
Community
  • 1
  • 1
prasun
  • 7,073
  • 9
  • 41
  • 59
  • Ok, Thanks prasun for giving assurance about the only way. i will try in php. – Prabhu Feb 08 '16 at 06:30
  • i want to know some details about netsuite . can u join http://chat.stackoverflow.com/rooms/102873/netsuite? – Prabhu Feb 08 '16 at 06:37