Get Authentication Token

Ram Singh
Ram Singh Member Posts: 5
edited September 2020 in Reckon One
Hello Guys,

We are trying to implement Reckon One API. I got success to get records from your website as discussed on below link:


https://reckonproduction.portal.azure-api.net/


I tried to implement the same thing in code, but I am not able to get the token. I tried but didn't succeed. 


I have used the attached code, please correct me where I am doing wrong:


The output I am getting from the following Request:


In Console:
Inline image 1



In Network Tab:


Inline image 2




Please help me work around. 


Wish and hope to hear back from you asap. 

Comments

  • Jason Hollis
    Jason Hollis Alumni Posts: 516 Reckon Staff
    edited September 2020
    Hi Ram,

    Your code snippets (images) dont seem to be visable?? Can you copy directly into the forum?
  • Ram Singh
    Ram Singh Member Posts: 5
    edited June 2017
    var params = {             // Request parameters             grant_type: 'password',             username: 'xxxxxx@xxxxxx.com',             password: 'xxxxxx',             scope: 'read+write',             Authorization: 'Basic MTIzNDo1xxxx',             MTIzNDo1Njc4: 'xxxxxxxx-xxxx-4xxx-9xxx-7fd287c9f06e:88dee5d7-ff30-4cc8-b360-22b27xxxxxx'         };          $.ajax({             url: "https://identity.reckon.com/connect/token?" + $.param(params),             beforeSend: function (xhrObj) {                 xhrObj.setRequestHeader("Authorization", "Basic MTIzNDo1xxxx");                 xhrObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                 // Request headers             },             type: "POST",             // Request body             data: "{body}",         })         .done(function (data) {             console.log(data);             alert("success");         })         .fail(function () {             alert("error"); 
    });
  • Jason Hollis
    Jason Hollis Alumni Posts: 516 Reckon Staff
    edited September 2020
    Hi Ram, 

    It's most likely the grant type of the authorization that you are expecting. We use Authorization Code by default for OAuth2. We do have a support ticket where I think you have requested Resource Owner. Is that correct?
  • Ram Singh
    Ram Singh Member Posts: 5
    edited June 2017
    Hi Jason,

    Yes, i requested, but not sure if it is the correct for me.. 


  • Jason Hollis
    Jason Hollis Alumni Posts: 516 Reckon Staff
    edited September 2020
    You now have the resource owner flow type assigned to your Identity Server credentials Ram, therefore check our online docs to ensure you are including the correct header syntax.
  • Ram Singh
    Ram Singh Member Posts: 5
    edited June 2017
    Hi Jason,

    I tried to use the Auth_code for Grant_Type, but still, it's throwing me same error. 
  • Jason Hollis
    Jason Hollis Alumni Posts: 516 Reckon Staff
    edited September 2020
    Hi Ram, so your grant type has been changed to Resource Owner as requested. Check our docs to make sure you are passing the correct header.
  • Ram Singh
    Ram Singh Member Posts: 5
    edited June 2017
    Hi Jason,

    Could you please share the link where you have specified this thing for Resource Owner.


  • Simon Hutchinson_8164484
    Simon Hutchinson_8164484 Alumni Posts: 135
    edited June 2017
    Hi Ram

    Now that Jason ha changed the identity server credentials, your grant_type is password as per your above code

    Thanks

    Simon H
    Reckon API 
  • Jason Hollis
    Jason Hollis Alumni Posts: 516 Reckon Staff
    edited September 2020
  • Jason Hollis
    Jason Hollis Alumni Posts: 516 Reckon Staff
    edited June 2017
    Look at Resource Owner. There are also links to a site that explains the grant types for OAuth2 so please ensure resource owner is for you. If not let us know. 
  • Jason Hollis
    Jason Hollis Alumni Posts: 516 Reckon Staff
    edited June 2017
    Here is that link I mentioned above: https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2

    Our default Grant Type is Authorization Code and we do not offer any others unless you provide your specific use case (which you did in your email to us).

    Other available are Implicit and Resource Owner. 

    The above site gives good examples on what each is best used for.