Jump to content

Trouble while authentication through Postman


 Share

Recommended Posts

Hello, 


I am having an error while attempting to use the API through Postman, after putting my credentials in, I get to this error page
image.png
 
I tried to use the settings in postman as close as they are listed in your tutorial : https://developer.sage.com/api/accounting/guides/postman/
 
image.png
Can you please assist me on where I got it wrong ? 
 
Thank you in advance, 
 
Edited by Guiheneuf
published too quicky
Link to comment
Share on other sites

  • Administrators

Hi Guiheneuf,

 

Thanks for getting in touch! 

The images you have included are broken links by the looks of it, so I cannot see what the errors you are getting are? 

I should check, have you already registered your application in order to specify you callback url, and obtain you client_id and client_secret?

Thanks,

Ben

Link to comment
Share on other sites

Hello Ben, 

Thank you for your answer, I will try to put those as attachments : is that better ? 
 
Yes I have my clientID and clientSecret, 

The error message displays "

Authentication error

Something went wrong with your authentication, please contact customer support.

Please contact the support team at [email protected] to resolve it - Reference EC02.

unnamed (1).png

unnamed.png

Link to comment
Share on other sites

  • Administrators

Hi Guiheneuf,

Can I ask which region of Accounting you are working with - are you using a trial account? 

You will need to ensure you have access to an Accounting Business, and its the email address and password you sign in with, that you must authenticate using in Postman. 

If you ensure you've cleared your cookies in Postman which will give you the region selection option during authentication also. 

 

If you still need to create a trial, please go here for links to all of our regions: https://developer.sage.com/api/accounting/guides/faq/

Thanks,

 

Ben

Link to comment
Share on other sites

Hi ben, 

 

I am using from France, and am trying to connect with a fully licenced solution "Sage 50c Premium" v.4.0.0, and the user I have does have full access to Accounting. 

I am having doubts wether if the product I have is compatible with the API... Are you familiar with this product ? 

 

Link to comment
Share on other sites

  • Administrators

Hi,

Unfortunately not, this API is specifically for Sage Business Cloud Accounting v3.1. I'd give the French team a call on 0 810 30 30 30 and see if they can advise what options there are for integration, but you are correct this API isn't compatible!

Let me know if you don't have any luck with them and I'll see what else I can find out for you.

 

Ben

Link to comment
Share on other sites

On 1/25/2021 at 8:36 AM, Ben Smith said:

Hi Guiheneuf,

Can I ask which region of Accounting you are working with - are you using a trial account? 

You will need to ensure you have access to an Accounting Business, and its the email address and password you sign in with, that you must authenticate using in Postman. 

If you ensure you've cleared your cookies in Postman which will give you the region selection option during authentication also. 

 

If you still need to create a trial, please go here for links to all of our regions: https://developer.sage.com/api/accounting/guides/faq/

Thanks,

 

Ben

Hi Ben,

We have the same issue described here, but we are using the Sage Cloud Business account, not Sage 50.   But we are on a Trial version for the moment because we want to evaluate if it will answer all our needs.

Is it a limitation of the Free Trial?  The error is slightly different so i've included the screenshot.

You seems to say that the developer account email should be the same as the owner of the Sage Cloud Business account?  That may also be my issue because the owner is a coworker.  He gave me full access, but i'm not the owner of it.

Thanks for your help

Image Pasted at 2021-2-1 15-41.png

Link to comment
Share on other sites

  • Administrators

Hi Christian, 

Welcome to the community! 

9 times out of 10, the error you have received relates to an issue with the callback URL you are using during authentication. 

Can I confirm you have:

  1. Access to a trial account for Sage Business Cloud Accounting (with the required permissions - you might need to speak to your coworker to confirm that in Settings > User Management (ideally ensure that they have given you full access).
  2. Registered an application in our app registry (https://developerselfservice.sageone.com/) - the callback URL you enter here must be exactly the same as you pass during authentication.

How are you using the API currently, are you scoping it out using Postman or in your own application?

Also, do you have an accounting business associated with the email address you are using to authenticate with?

Thanks,

 

Ben

 

Link to comment
Share on other sites

3 hours ago, Ben Smith said:

9 times out of 10, the error you have received relates to an issue with the callback URL you are using during authentication. 

Can I confirm you have:

  1. Access to a trial account for Sage Business Cloud Accounting (with the required permissions - you might need to speak to your coworker to confirm that in Settings > User Management (ideally ensure that they have given you full access).
  2. Registered an application in our app registry (https://developerselfservice.sageone.com/) - the callback URL you enter here must be exactly the same as you pass during authentication.

How are you using the API currently, are you scoping it out using Postman or in your own application?

Also, do you have an accounting business associated with the email address you are using to authenticate with?

 

I've got full access as you can see bellow.

image.thumb.png.20c9c996a904f0e17b742307be679ac2.png

 

As for which version i'm using, it's hard to say.  I know that my coworker activated the trial for "Sage Accounting Start", but then had to switch to "Sage Accounting" which is more complete (because he couldn't import our older version in it).

image.thumb.png.f157824e4e6d21a2b6fcf621bad7e043.png

 

I've also got my app registered with the proper callback URL

image.thumb.png.5937f86502d221351b17739997647dc8.png

We are using Postman for the test purpose, but it will be used in our application when our tests will be completed.  Here's my postman request for new Token.  I've set some variables for the client id, client secret and the callback url

image.thumb.png.83e13efdf28957f3471b3958f7763d88.png

image.thumb.png.31a29c09e0b317f4f0028485c83f4ff5.png

 

And to answer your last question, i use the same email for Sage Accounting, and Sage Developer Accounting.  For our Sage Accounting i'm a user with Full Access as you saw previously, i'm just not the owner and i don't know if that make a difference.  This morning i'll create a developer account with my coworker email, create an app, change all my client ID & Secret & Call back URL to see if it fix anything.

Thanks for your help

Christian

 

 

image.png

image.png

Link to comment
Share on other sites

12 hours ago, Ben Smith said:

Can I confirm you have:

  1. Access to a trial account for Sage Business Cloud Accounting (with the required permissions - you might need to speak to your coworker to confirm that in Settings > User Management (ideally ensure that they have given you full access).
  2. Registered an application in our app registry (https://developerselfservice.sageone.com/) - the callback URL you enter here must be exactly the same as you pass during authentication.

How are you using the API currently, are you scoping it out using Postman or in your own application?

Also, do you have an accounting business associated with the email address you are using to authenticate with?

 

Hi Ben,

I've just done the following test:

  • created a new Free Trial account for Sage Accounting with another email address
  • created a new company DB from scratch
  • created a new Developer Account with the same email used for Sage Accounting Free Trial
  • created an App in it, with correct callback url
  • changed the client id and client secret in my postman

By doing this, i'm sure that:

  • It's not because i'm not the owner of the db
  • It's not because i'm testing from an import from a really old version of Simply Accounting Pro 2009

But still have the same issue.

The more i dig, the more i think it's an issue with the "Free Trial".  They probably don't give access to the API for Trial.  I'll create a non-trial account to see if it fix the problem.

 

Christian

Link to comment
Share on other sites

  • Administrators

Hi Christian, 

The trial account is 100% usable via the API, I've sent you a private message asking for your email address for the accounting business and I can extend that for 12 months for you free of charge. 

Looking closely at the postman variables - it looks as though the client_secret isn't being passed as a valid variable. It shows in red on the token auth screen - when you look at your variables it looks like there might be a line break character showing (I've attached a screenshot of what I mean). 

Screenshot 2021-02-03 at 09.00.21.png

Can you clear the variable name, and try it again for me please?

 

Ben

 

Link to comment
Share on other sites

9 hours ago, Ben Smith said:

Hi Christian, 

The trial account is 100% usable via the API, I've sent you a private message asking for your email address for the accounting business and I can extend that for 12 months for you free of charge. 

Looking closely at the postman variables - it looks as though the client_secret isn't being passed as a valid variable. It shows in red on the token auth screen - when you look at your variables it looks like there might be a line break character showing (I've attached a screenshot of what I mean). 

Screenshot 2021-02-03 at 09.00.21.png

Can you clear the variable name, and try it again for me please?

 

Ben

 

Thanks for the 12 months trial for the API tests.  

 

I didn't noticed this "CR" character at the end.  I've removed it, and went a step further.  It told me that it would send a code by email.  So i've copied the code from the email in this field, submit, then it brought me back to the same error windows that i had before.  And now if i test again and again, it doesn't ask for code anymore.

 

Christian

Link to comment
Share on other sites

I didn't knew how to clear cookies within Postman for Desktop, so i've opened it from their web site.   Cleared the cookies of course in Google Chrome, but i'm still having the same issue.  I've made sure to pick English Canada first because by default it's English US.   

I've checked the Service Status but there's only a problem in Africa.  North America is green.

Link to comment
Share on other sites

24 minutes ago, Ben Smith said:

Ok, thanks for the update - if you clear all cookies in Postman then try again what do you get?

 

Ben

Ok it work now!   I've deleted all my variables, one by one.  And it seems the URL was causing the problem.  I've been able to get a New Access Token.

 

I've tried to do a simple request from the API Contacts (countries / Return all countries) but i've got a message like 

Your access token has expired. You can refresh the token or ask the user for a new grant.

I've refreshed the token, did the request again but still have the same error. 

 

Christian

Link to comment
Share on other sites

1 minute ago, Christian de Bellefeuille said:

Ok it work now!   I've deleted all my variables, one by one.  And it seems the URL was causing the problem.  I've been able to get a New Access Token.

 

I've tried to do a simple request from the API Contacts (countries / Return all countries) but i've got a message like 

Your access token has expired. You can refresh the token or ask the user for a new grant.

I've refreshed the token, did the request again but still have the same error. 

 

Christian

nevermind.  Had few token in my postman list... cleared them all, then requested a new one, and tried the endpoint again and it work perfectly.

Thanks a lot for your help Ben!   I'll see what was wrong with my callback url variable so i can use them again properly.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Good afternoon Ben,

I need some assistance please. I seem to struggle with the same issue.

I have read through and as best possible replacated the fixes you suggested to Christian. We are operating on Sage One (Region : South Africa) 

There does however not seem to be an approriate option for me on the below screen.image.png.83420e040d8cd339ae9592efc373a83f.png

Can you please help me here?

image.png

Link to comment
Share on other sites

  • Administrators

Hi Colet,

The version of Sage Business Cloud Accounting available in South Africa is a different product, and requires the use of a different API. As such there is a different site available to give you details etc. to get started. You can find the pages here: Developer API - Sage Business Cloud Accounting | Sage South Africa

The page has links to register your app for use with this API, details on the auth process and a full API specification.

I hope that helps,

 

Ben

Link to comment
Share on other sites

  • 2 years later...

Hi Ben

I need some assistance please. 

I have read through and as best possible replicated the fixes you suggested to Christian and Colet Smit. We are operating on Sage One (Region : Pakistan - Asia) 

There does however not seem to be an appropriate option for me on the below screen.image.png.83420e040d8cd339ae9592efc373a83f.png.1252fabd37fedfa6c16822188683dfa0.png

Kindly Help me out.

Link to comment
Share on other sites

Hi @Faisal Ahmed,

Thank you for your question. The region selection is for the user who is authorising the connecting application to select based on their business location.
The API's referenced in this thread are applicable to Sage Business Cloud Accounting businesses in CA, ES, FR, IE, UK and US regions. 

Which location is the trial business you are using for your development registered to? - https://developer.sage.com/accounting/quick-start/set-up-the-basics/

Thanks

Mark 

Link to comment
Share on other sites

On 9/15/2023 at 12:49 PM, Steel, Mark said:

Hi @Faisal Ahmed,

Thank you for your question. The region selection is for the user who is authorising the connecting application to select based on their business location.
The API's referenced in this thread are applicable to Sage Business Cloud Accounting businesses in CA, ES, FR, IE, UK and US regions. 

Which location is the trial business you are using for your development registered to? - https://developer.sage.com/accounting/quick-start/set-up-the-basics/

Thanks

Mark 

Thank You @Steel, Mark for the reply. It's working now.

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...