The Postman collection requests work , with the same credentials (basic auth) , the maven smart doc plugin fails with a 401.
Any suggestions
Thanks
Mehedi
===
mvn install -Pdev -Dpropfile=DEV.properties -Dapigee.smartdocs.config.options=sync -Dpusername=xyzxyz -Dppassword=xyzxyz
[INFO] Scanning for projects... [INFO]
[INFO] -----------------------< Apigee:DeveloperPortal >-----------------------
[INFO] Building DeveloperPortal 1.0 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ DeveloperPortal ---
[INFO] Installing apigee/smartdocs/apigee-smartdocs-maven-plugin-master/samples/drupal8/DevPortal/pom.xml to /home/xxxxx/.m2/repository/Apigee/DeveloperPortal/1.0/DeveloperPortal-1.0.pom
[INFO] [INFO] --- apigee-smartdocs-maven-plugin:2.0.1:apidoc (smartdocs-deploy) @ DeveloperPortal ---
[INFO] ************************************************************************
[INFO] API Docs [INFO] ************************************************************************
[INFO] Get OpenAPI Specs from ./specs
[INFO] Getting API doc for Swagger Petstore [INFO] Retrieving Swagger Petstore doc.
[INFO] API Doc: Swagger Petstore does not exist
[INFO] Getting API doc for Swagger Petstore
[INFO] Retrieving Swagger Petstore doc.
[INFO] API Doc: Swagger Petstore does not exist
[INFO] Importing spec.. [ERROR] 401 Unauthorized
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.327 s
[INFO] Finished at: 2020-05-22T15:45:07-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.apigee.smartdocs.config:apigee-smartdocs-maven-plugin:2.0.1:apidoc (smartdocs-deploy)
on project DeveloperPortal: Execution smartdocs-deploy of goal com.apigee.smartdocs.config:apigee-smartdocs-maven-plugin:2.0.1:apidoc failed:
Update failure: 401 Unauthorized -> [Help 1]
[ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
More information, here is the error message in the Drupal 8 logs
++++++++++++++++++
Type php
Date Friday, May 22, 2020 - 15:21
User Anonymous (not verified)
Location https://dev.internal.intient.com/INTIENT/web/jsonapi/apidoc/apidoc/spec
Referrer
Message
Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException: No authentication credentials provided. in Drupal\basic_auth\Authentication\Provider\BasicAuth- >challengeException() (line 168 of /var/www/html/INTIENT/web/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php).
Severity Error
Hostname 192.168.16.5
Operations
Hello
I just tested this in both ways. It worked with both.
a) passing the username and password from command line
b) adding it in pom.xml
Please make sure you don't have a trailing slash at the end of your portal URL. It should look like this.
<portal.url>https://yourportal-url.com</portal.url>
When I added a trailing slash, like shown below, it gave a 401 for the same credentials that worked above.
<portal.url>https://yourportal-url.com/</portal.url>
Hope that helps!
Thanks , that was the issue the path has a trailing character , Phew