0
votes

i have used wso2 Idendity server version 5.7.

i have created token below curl.

curl -X POST \
  https://localhost:9443/oauth2/token \
  -H 'Accept: */*' \
  -H 'Authorization: Basic dUJqVGZncU1vTHpUQWJwU2U3QXhyYzF3cGRvYTpQVjFLM2ZUM1o3Qm9jVFl3dF9wM214ZzYwQVlh' \
  -d 'grant_type=password&username=admin&password=admin'

they will giving below response jwt formate.

{
    "access_token": "eyJ4NXQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJraWQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbkBjYXJib24uc3VwZXIiLCJhdWQiOiJ1QmpUZmdxTW9MelRBYnBTZTdBeHJjMXdwZG9hIiwibmJmIjoxNTU2NjEyMzAxLCJhenAiOiJ1QmpUZmdxTW9MelRBYnBTZTdBeHJjMXdwZG9hIiwiaXNzIjoiaHR0cHM6XC9cL2xvY2FsaG9zdDo5NDQzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNTU2NjE1OTAxLCJpYXQiOjE1NTY2MTIzMDEsImp0aSI6IjBiNDNiNDJhLTNmMGQtNDczZS05MjgwLWYzMDUyOTE5MDA0NSJ9.BxHpuoYJVpDPH4kauU7C6c9eSn-DDO3k40QQjDSBS3g7_dHDRCXvf1xBFe3dxggth-eomvo1kiIGQtC8_VzvL5umvM1VKkL_DqxDyWmM9CtFHj-MkDROS_81ZcWlME6__69vy68l9_cfM7XCUpkJ2JMAeFV2kS2jAvlIpSn3xcJWDMNNhcC60syrua_aATwNot6DQiy032c1uN2KOWEqLbhLMxDrue41jkhlQ7Kt4i-B7J385O7Rvju6bJ6SoTy-zU92ewXwrXctooLGbd_y-MQmXp0PTp2PqmBtgb5Ryrg9An3AbCavEjzYeJbSj2hIsKzU5dpH_KE670gEGW94jw",
    "refresh_token": "253c5d9f-4efd-3b63-8451-66a0f83b2c72",
    "token_type": "Bearer",
    "expires_in": 3600
}

Problem :

1) when i have called any request using Bearer authorization token,giving below error but Basic YWRtaW46YWRtaW4= working fine.

{
    "Errors": [
        {
            "code": "401",
            "description": "Authentication failed for this resource."
        }
    ]
}

2) Refresh token giving plain text how to convert jwt formate also.

1
This question is not clear. Could you elaborate more on what is the requirement and the steps and the documentation you followed,Vithursa M
@user3686193 i have updated question.akshay parmar
I have tried similar scenario in IS 5.7.0 it is working as expected. Generated token and invoked userinfo endpoint for testing. Which endpoint you are calling in 1)? At the time you got 401, could you try invoking introspection endpoint and verify whether the token is active - docs.wso2.com/display/IS570/…Vithursa M
@user3686193 i have tried below curl :- curl -X GET \ localhost:9443/wso2/scim/Users \ -H 'Accept: /' \ -H 'Authorization: Bearer access Token' \ -H 'Content-Type: application/json'akshay parmar
It seems the user does not have the required permission to invoke the endpoint you are trying. Are you sure you are generating the access token with the same user as you tested scim APIs with basic auth?Sajith

1 Answers

0
votes

Just in case if there is user permission issue, you will get

{"Errors":[{"code":"500","description":"User is not authorized to perform provisioning"}]}

Since your error message is

{
    "Errors": [
        {
            "code": "401",
            "description": "Authentication failed for this resource."
        }
    ]
}

it is mainly due to invalid access token. You can check it by simply sending some random string as an access token. I would suggest you to check it from client side where you send correct access token or not.