Hello! I've created a test API account, and received my key. My first order of business is to get a bearer token, naturally. When I POST using my usual HTTP methods (using C#) I get just "401 Unauthorized", so I tried using curl as described in the man page. I've matched everything in the example, aside of course from entering my own creds, client ID, and URL, but I get "invalid grant type" - despite having "-d grant-type=password" in the parameters:
curl -v --request POST
-H "Content-Type: application/x-www-form-urlencoded"
-d grant-type=password -d email@example.com -d password=xyz
-d client_id=xyz https://mycompany.egnyte.com/puboauth/token
Quoting or not quoting the password and the word "password" after grant-type has made no difference so far. The one thing that stands out is that my user name includes an ampersand, but using %40 in place does not help.
Can anyone see what I'm doing wrong? Thank you!
Hi @Jon of All Trades it may be best to contact our API Support team directly at firstname.lastname@example.org for further assistance with this issue.
In the e-mail, please provide the Main API key you attempted to generate a bearer token with, so we may inspect the API key configuration via our dashboard.
You may also refer to the common [Error Codes] published in the Internal Application - Authentication section of our API documentation: https://developers.egnyte.com/docs/read/Public_API_Authentication#Internal-Applications
I did trade some e-mails with support, but he was useless; his only suggestion was to use a different user name, which is not the one I use to log in. It didn't work any better.
@Jon of All Trades I managed to look up the Support ticket, and wanted to make the additional recommendations:
1. Per our API Documentation, one of the authentication requirements is an Egnyte <username>
Please note that our WebUI login accepts either username or e-mail address format, but for API authentication, you must use the username (e.g. jalltrades) format explicitly
2. As noted in the common [Error Codes] found in the link I provided, and from past experience, a 403 Error for INVALID_USERNAME_OR_PASSWORD is usually related to special characters within the password itself.
Try simplifying your password to alphanumerical characters along with the <username> format, and check if the issue persists.
Indeed, you can see "-d username" in the parameters. The actual user name I'm passing is the same one I use, successfully, when logging in to the Egnyte developers interface (e.g., to retrieve my API key).
If the Egnyte API does not support ampersands in user names, or dashes in passwords, that should be documented. I've tried URL encoding the user name, but I get the same results.
@Jon of All Trades -d email@example.com is not the same as your actual Egnyte username. I'll paste a screenshot in the Support ticket to show the difference.
Egnyte supports special characters with passwords, but we are not able to control 3rd party HTTP libraries, especially when it pertains to API REST clients. Thus, the recommendation to simplify your password to alphanumerical characters when such issue occurs.
Please take some time to go over the links I've provided for full documentation of our API methods and requirements.
Egnyte transforms business through smarter content allowing organizations to connect, protect, and unlock value from all their content.
© Egnyte, Inc. All Rights Reserved
If you can't find what you're looking for, contact Egnyte Customer Support.