Can't get retrun response from /api/v2/users/<user_id>.json API

7 Kommentare

  • Tipene Hughes
    Zendesk Developer Advocacy
    Hi Vishwanath,
     
    Since you're making a client-side request to the API, you will need to authenticate with an Oauth token in order for CORS to be implemented. Here's a link to article which goes in to more detail:

    https://developer.zendesk.com/documentation/ticketing/using-the-zendesk-api/making-cross-origin-browser-side-api-requests/
     
    I hope this helps!
     
    Tipene
    0
  • Vishwanath Hokrani

    Hi Tipene,

    I'm not yet deployed my client application in produciont, so building in my local system.

    In this case, what should be the redirect url as i don't have registered domain name yet.

    is it http://127.0.0.1 or https://<ip address my local system>

     
    0
  • Tipene Hughes
    Zendesk Developer Advocacy
    Hi Vishwanath,
     
    The redirect URL is where the user will be sent after access is granted to the app so if you'd like them to be sent to the root page of your app, http://127.0.0.1 or http://localhost:{port} should work just fine.
    0
  • Vishwanath Hokrani

    Hi Tipene,

    I have setup same thing, but still getting same error message. 

    In 'OAuth Clients' tab, setup as below:

    Below code used :

     

      export const getUserName=async(author_id,login,password)=>{
                      const access_token='<token from UI generated in 'OAuth Clients' tab>';
                        var request = new XMLHttpRequest();
                      var url = '<baseURL>'+`/api/v2/users/${author_id}.json`;
                        request.open('GET', url, true);
                        request.setRequestHeader("Authorization", "Bearer " + access_token);
                        request.send()
    }

    Let me know if you need further information. 
    0
  • Tipene Hughes
    Zendesk Developer Advocacy
    Hi Vishwanath,
     
    Can you confirm that the authorization flow is being run successfully and you're seeing the access token returned in the redirect URL?
    0
  • Vishwanath Hokrani

    Hi Tipene,

    No, authorization flow is not run successful and token is not returned in redirect URL. 

    If you need further information, i will setup demo to you. 

    0
  • Tipene Hughes
    Zendesk Developer Advocacy
    Hi Vishwanath,
     
    Thanks for letting me know.
     
    I'm going to create a ticket so we can take a look at your implementation in a bit more detail. You should see an email coming through from me shortly.
     
    Thanks!
     
    Tipene
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk