I am trying to access a rest API secured by APP ID service instance.
I have tried two approaches to access the rest resource but alway I get <title>Redirect To OP</title>
redirect HTML as the response instead of an actual resource.
1. approach 1
Using cloud directory user & and grant_type=password for token endpoint
1.1 I have added a user and password in cloud directory.
1.2 HTTP POST to <oauthServer>/token
endpoint with clientID and Secret as Basic authentication and grant_type=password
, username=<cloud_direcotry_user>
, password=<password>
1.3 I get access_token and Identity Token
1.4 Invoked protected resource with authorization header that has an access token and identity token as header value 'authorization' Bearer <accesstoken> <identity token>
1.5 response contains redirect HTML instead of actual resource JSON/XML.
Approach 2
2.1 Fetch access token using <oauthserverUrl>/token
endpoint and grant_type=client_credentials
add Basic authentication with Client ID and Secret as username and password
2.2 I got access token with type Bearer
2.3 invoke protected resource with authorization header
authorization: Bearer <access_toke>
2.4 I get the same redirect response<title>Redirect To OP</title>
instead of actual resource JSON/XML
___ New Update____
Here is the iberty's openid connect client configuration of the resource provider.
<openidConnectClient id="<identifier>"
clientId= "${APPID_CLIENT_ID}"
clientSecret= "${APPID_CLIENT_SECRET}" authorizationEndpointUrl="${APPID_AUTH_SERVER}/authorization"
tokenEndpointUrl="${APPID_AUTH_SERVER}/token"
jwkEndpointUrl="${APPID_AUTH_SERVER}/publickeys"
issuerIdentifier="${APPID_AUTH_SERVER_ISSUER}"
tokenEndpointAuthMethod="basic"
signatureAlgorithm="RS256"
authFilterid="myAuthFilter"
trustAliasName="ng.bluemix.net"
trustStoreRef="appidtruststore"
redirectToRPHostAndPort="https://${env.APPID_SAMPLE_HOST}:${env.APPID_SAMPLE_SSL_PORT}"
userIdentityToCreateSubject="email"
inboundPropagation="supported"
validationEndpointUrl="${APPID_AUTH_SERVER}/introspect"
validationMethod="introspect"
/>