Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

authentication failed when authtype is oauth

Hello All,

I have configure oauth type to oauth in maven profile. While building the code in jenkins Access token is validated but still api calls to MS server is failing with 401. Below is the console output:

Plugin version: apigee-config-maven-plugin is 1.4.3

[INFO] Retrieving config from /var/SP/data/jenkins/workspace/dev-deploy/TestAPI/edge.json

[INFO] Validating the access token passed

[INFO] Access Token valid

[INFO] Request prepared for the server ************************** GET http://msserver/v1/organizations/apixdev/environments/dev/keyvaluemaps accept: [application/json] accept-encoding: [gzip] authorization: [Bearer [Not shown in log]

[ERROR] 401 Unauthorized [INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------

[INFO] Total time: 4.653 s [INFO] Finished at: 2020-08-07T12:24:24+01:00

[INFO] Final Memory: 25M/238M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.apigee.edge.config:apigee-config-maven-plugin:1.4.3:keyvaluemaps (create-config-kvm) on project TestAPI: Apigee network call error 401 Unauthorized -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.apigee.edge.config:apigee-config-maven-plugin:1.4.3:keyvaluemaps (create-config-kvm) on project TestAPI: Apigee network call error 401 Unauthorized

Solved Solved
0 32 2,409
1 ACCEPTED SOLUTION

Hello Sai,

Thanks for the help.

Now authentication is working either way. i.e.

1. if we are configuring plugin to generate the token

Issue founded: URL was not complete. It should be like <sso ulr>/oauth/token

or ,

2. we are generating the token before maven plugin is being used.

Issue founded: There were double quotes in the token passed. While validating the token code was ignoring the quotes hence validation was successful but while using it for authentication double quotes were used.

Thanks again.

Take care.

View solution in original post

32 REPLIES 32