4

I'm working with new SAGE API v3.1.

For first steps, I'm testing with Postman according manual for get authorization.

Any problem, with test. When make a call for get New Access Token, postman send request, and SAGE open a modal window for ask my credentials for connect my request to one account.

Well. I try several options with Laravel 5.7, include modifications on Laravel Socialite, but not work. On all tries, get a Internal Server Error and I assume it's because I'm sending the request wrong.

On SAGE manual, I don't see more that Postman example for get access token. Not example for php, curl, ...

For others request I don't problem using Guzzle, but I need get tokern y refreesh token, with Postman. Horrible.

enter image description here

Image show real information for Test account.

On postman console, get some infor, but I lost with this and Internal Server error

Request Headers: content-type:"application/x-www-form-urlencoded" user-agent:"PostmanRuntime/7.3.0" accept:"*/*" host:"oauth.accounting.sage.com" accept-encoding:"gzip, deflate" content-length:274 Request Body: grant_type:"authorization_code" code:"ES/e1fd0bc2-1d06-41b6-902a-beb584f24ccf" redirect_uri:"https://localhost/login/sage/callback" client_id:"c420127c-76f3-48e5-9c11-77fcba90402d/2c09ea61-249c-4958-96f0-89209f1939e8" client_secret:"?]@4iVWBhx/)gN;bA2M%" 

NOTE: All data es valid for testing. NOTE2: this is a piece that i don't understand code:"ES/e1fd0bc2-1d06-41b6-902a-beb584f24ccf" What is it? How to generate?

With this data, I try to put link https://www.sageone.com/oauth2/auth/central?grant_type%3Aauthorization_code%26code%3DES%2F37048339-8db2-4168-bfb0-760ef6709b93%26redirect_uri%3Dhttps%3A%2F%2Flocalhost%2Flogin%2Fsage%2Fcallback%26client_id%3Dc420127c-76f3-48e5-9c11-77fcba90402d%2F2c09ea61-249c-4958-96f0-89209f1939e8%26client_secret%3D%3F%5D%404iVWBhx%2F)gN%3BbA2M%25%0A) imitate Postman, but after put my credentials, not return to callback. It instead got to SAGE Account.

1 Answer 1

1

Postman sends the get new token request as a GET request, Laravel expects it to be a POST request.

I had to make my own POST OAuth Token request in Postman to get it to work since the Postman new access token feature does not let you change the request method to POST. From a custom POST request you have to manually copy the response token, Right click edit your collection, go to Authorization tab, Select Type OAuth 2.0 and paste in your oAuth token in the available field.

All requests than need to use the token, make sure in the Authorization tab of each request entry that Inherit auth from parent is selected for the TYPE in order to inherit the token from the collection.

Sign up to request clarification or add additional context in comments.

1 Comment

I see more clear, in Authorisation Code Grant (section 4.1) I now undestand well, and I get a code + state in frist step. I think that in first step I get token.... Therefore, I understand that in the return call, I must send a new POST, to pick up this time if, the access tokens

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.