Comments (2)
Hello @frec-hansen ,
Thank you for reaching out with your issue regarding the 401: Not Authorized
error in the node-zendesk
library. After reviewing the details, it seems the problem stems from the way OAuth tokens are being handled, i.e. not a bug--you need to provision an OAuth token.
To help you navigate this, I've updated the library and added a detailed example script. Here are the key updates and some important guidelines:
-
New OAuthClients Class: I've introduced a new
OAuthClients
class in the library. This class offers functionalities for managing OAuth clients, including listing, creating, updating, and deleting OAuth clients, and generating client secrets. -
Detailed Example Script: An example script has been updated with comprehensive JSDoc comments. It demonstrates how to create a read-only OAuth token, which involves retrieving your OAuth client's numeric ID using its unique identifier. You can find this script @ https://github.com/blakmatrix/node-zendesk/blob/master/examples/create-oauth-token.js.
-
Provisioning an OAuth Token: It's important to note that for using the library, you need to provision an OAuth token specifically for this purpose. The secret token you mentioned is used in a different context with a back and forth OAuth Client. The example script will guide you through creating an OAuth token with the necessary scopes. Initially, you'll need your username/password or username/API token (and appropriat admin access of course) to generate an OAuth token in this method.
-
Setting Appropriate Permissions: The example demonstrates creating a token with read-only access for users and tickets. Depending on your needs, you can adjust these scopes to grant more permissions. Please refer to the Zendesk documentation on Creating and using OAuth tokens with the API for more detailed guidance or alternitive methods for provisioning(i.e. curl).
-
Using the OAuth Token for Authentication: Once you've generated the OAuth token, you can use it to authenticate in the client. Keep in mind the permissions (scopes) assigned to the token will dictate what actions you can perform through the API.
I hope these updates and instructions will help you resolve the authorization issues. Please pull the latest version of the node-zendesk
library to access these new features and improvements. If you have any further questions or face additional issues, feel free to reach out.
Best regards,
Farrin
from node-zendesk.
Thanks for the detailed reply and updated example. I will revert back and use the username/password auth since it is a lot easier. I just want minimum setup to use it. BTW. I want to point out that some of the documents probably also need to be updated. When I was using users.createOrUpdate according to doc like this:
zendeskClient.users.createOrUpdate({ name:"test", email:"[email protected]" });
I got a 400 response.
Turns out the attributes needs to be wrapped in user object:
zendeskClient.users.createOrUpdate({ user: { name:"test", email:"[email protected]" } });
from node-zendesk.
Related Issues (20)
- Apps
- jobStatuses.watch probably needs some love
- Release `fetch` changes HOT 5
- Update Documentation
- fetch is not defined HOT 2
- 404 calling createMany for Organization Memberships
- OrganizationMemberships deleteMany does not work as implemented. HOT 1
- TLC Tickets class
- TLC Users.js
- OAuth doesn't work HOT 1
- version 5.0.2 return Zendesk error 401 while 3.0.3 is ok HOT 2
- how to set the request rate, meet 204 code when enable throttle in createClient option HOT 1
- Mismatched types HOT 6
- Explore replacing this with a (mostly) autogenerated client based off the OpenAPI spec
- Update Many Users like describe in example doesn't work
- Include type definition or more extensive docs for the response of `client.search.query`
- All links on API documentation Readme are broken HOT 1
- socket hang up error on attachments HOT 3
- New sport street racket
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-zendesk.