Get Authentication Token

Ram SinghRam Singh Member Posts: 5
edited September 7 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 HollisJason Hollis Reckon Staff Posts: 616 ✭✭
    edited September 7
    Hi Ram,

    Your code snippets (images) dont seem to be visable?? Can you copy directly into the forum?
  • Ram SinghRam Singh Member Posts: 5
    edited June 2017
    var params = {             // Request parameters             grant_type: 'password',             username: '[email protected]',             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 HollisJason Hollis Reckon Staff Posts: 616 ✭✭
    edited September 7
    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 SinghRam Singh Member Posts: 5
    edited June 2017
    Hi Jason,

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


  • Jason HollisJason Hollis Reckon Staff Posts: 616 ✭✭
    edited September 7
    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 SinghRam 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 HollisJason Hollis Reckon Staff Posts: 616 ✭✭
    edited September 7
    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 SinghRam 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 HutchinsonSimon Hutchinson Reckon Staff Posts: 155
    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 HollisJason Hollis Reckon Staff Posts: 616 ✭✭
    edited September 7
  • Jason HollisJason Hollis Reckon Staff Posts: 616 ✭✭
    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 HollisJason Hollis Reckon Staff Posts: 616 ✭✭
    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. 
Sign In or Register to comment.