Needs to Get access code without prompt the login screen.

This thread is now closed to new comments.
Some of the links and information provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
Narender9878
Partner
3 Posts
Partner

3Posts

0Kudos

0Solutions

Needs to Get access code without prompt the login screen.

 I want to get access token without going to the login screen. When I send a CURL request to obtain access token I am redirected to myob login screen, how to skip that?

2 REPLIES 2
Triboss
Valued Partner
99 Posts
Valued Partner
Valued Partner

99Posts

6Kudos

15Solutions

Re: Needs to Get access code without prompt the login screen.

You need the user to login to their account via secure.myob.com to authenticate and retrieve the access code initially.  After that you can use the access token and refresh token without the user re-authenticating via the website.

CloudSupport3
Partner
2 Posts
Partner

2Posts

0Kudos

0Solutions

Re: Needs to Get access code without prompt the login screen.

I need to do the same, as I am trying to connect to MYOB via an Azure function.

 

This is the code that MYOB have published - 

 

var developerKey = "YOUR API KEY";
var developerSecret = "YOUR API SECRET";

var configuration = new ApiConfiguration(developerKey, developerSecret, "http://desktop");
var oauthService = new OAuthService(configuration);
var tokens = oauthService.GetTokens(OAuthLogin.GetAuthorizationCode(configuration)); 
var keystore = new SimpleOAuthKeyService();keystore.OAuthResponse = tokens;

// Get Company Files 
var cfService = new CompanyFileService(configuration, null, keystore);
var companyFiles = cfService.GetRange();

The problem is the GetAuthorizationCode function as that function opens the MYOB login page and returns the authorization code via the HTML. 

 

Surely there must be another way to generate the code? 

Didn't find your answer here?

Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post