Jump to content

Laravel system logging into Sage via API/Oauth2


 Share

Recommended Posts

Hi

I've created a developer account and app so I've my id/secret. I've then imported into Postman the Sage settings.

When I either go to the main section and/or a sub category (such as contacts) when I try to get a token I get the following message:

Authorise Application Error

We are very sorry, but there has been a problem. Please try again

If you continue to have issues then please email [email protected] or call the Customer Service Team on 0845 1116 611

 

When I run this in my Laravel system:-

		$authorisationUrl = 'https://www.sageone.com/oauth2/auth/central?filter=apiv3.1';
		$tokenUrl = 'https://oauth.accounting.sage.com/token';
		$redirectUrl = 'https://???.?????.co.uk/api/v1/sage/sageCallback';
		header('Location: ' . $authorisationUrl . '?'
			. "&response_type=code"
			. "&client_id=".$clientId
			. "&state=".$branchId
			. "scope=full_access"
			. "redirect_uri=". $redirectUrl
			);

 

I click the login button, get the sage screen to allow/deny access,  but when I click allow, I then get this screen:-

https://oauth.pstmn.io/v1/browser-callback?error=temporarily_unavailable&error_description=The+backend+service+is+temporarily+not+available.+Please+try+again+later.&state=dev

Authentication complete

You can close the tab and go back to the Postman app.

Which is bizarre because I make no reference to postman and would expect to be redirected to my redirect uri!

Can someone help me in moving forward and obtaining a token.

Cheers
Carl

Link to comment
Share on other sites

5 hours ago, Carl Ogden said:

Hi

I've created a developer account and app so I've my id/secret. I've then imported into Postman the Sage settings.

When I either go to the main section and/or a sub category (such as contacts) when I try to get a token I get the following message:

Authorise Application Error

We are very sorry, but there has been a problem. Please try again

If you continue to have issues then please email [email protected] or call the Customer Service Team on 0845 1116 611

 

When I run this in my Laravel system:-

		$authorisationUrl = 'https://www.sageone.com/oauth2/auth/central?filter=apiv3.1';
		$tokenUrl = 'https://oauth.accounting.sage.com/token';
		$redirectUrl = 'https://???.?????.co.uk/api/v1/sage/sageCallback';
		header('Location: ' . $authorisationUrl . '?'
			. "&response_type=code"
			. "&client_id=".$clientId
			. "&state=".$branchId
			. "scope=full_access"
			. "redirect_uri=". $redirectUrl
			);

 

I click the login button, get the sage screen to allow/deny access,  but when I click allow, I then get this screen:-

https://oauth.pstmn.io/v1/browser-callback?error=temporarily_unavailable&error_description=The+backend+service+is+temporarily+not+available.+Please+try+again+later.&state=dev

Authentication complete

You can close the tab and go back to the Postman app.

Which is bizarre because I make no reference to postman and would expect to be redirected to my redirect uri!

Can someone help me in moving forward and obtaining a token.

Cheers
Carl

Finally resolved it!

 

The header was built incorrectly, by removing the '?' and adding in the missing last 2 "&" it now works for me, onto the next issue!

 

Carl.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...