'Provided Authorization Grant is invalid' error while trying to login a dockerized application using wso2

爱⌒轻易说出口 提交于 2020-03-20 14:37:51

问题


I have dockerized our Angular application which have been using WSO2 as API manager . After doing the configurations, i was able to run the application successfully and able to hit all existing api's. The only issue arises when i tried to use oath2/token api for performing login operation of our customer . Even though, the same code was used to perform authentication earlier(before dockerization) without any issues,now i am getting error as

{
  "error": "invalid_grant",
  "error_description": "Provided Authorization Grant is invalid"
}

Token generation api for login :

https://<myapplicationurl>:9443/oauth2/token

Errors am getting in docker console while trying to login using username 'devtest7@mailinator.com' :

Things to note :

  • WSO2 AM version is 2.1.0 , WSO2 IS version is 5.3.0
  • Arguments(headers & parameters) for the request is the same as that used earlier(except the username and password).
  • I am able to create a new users and the corresponding user is listed in Carbondb users list.
  • The issue exists while trying to login using existing user as well as newly created users.
  • I have recently generated new ssl certificate for the application.
  • Able to login using super admin only . Login using newly created email and username is not working.

I tried solutions seen on stackoverflow which doesn't fixed my issues. Can any one please help?


回答1:


According to the logs, it says

Non-SaaS service Provider's tenant domain is not same as user tenant domain; carbon.super != mailinator.com

From the logs, the SP's is in the carbon.super tenant. But it considers the user as in the tenant mailinator.com.

When we specify the username for password grant with email as username, we have to use the full username with the tenant domain. (devtest7@mailinator.com@carbon.super).




回答2:


Thanks for everyone who commented and tried to figure out the solution for the issue i mentioned. I got the resolution for the issue . As i tried multiple times to login by doing permutations and combinations in configurations, authentication was blocked for me. As a reason, i couldn't login and generate access token . I was able to resolve it by changing a flag in identity.xml file inside IS . Changed the UserOperationEventListener enabling from 'true' to 'false' .

Before:

<EventListener enable="true" name="org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener" orderId="95" type="org.wso2.carbon.user.core.listener.UserOperationEventListener"/>

After:

<EventListener enable="false" name="org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener" orderId="95" type="org.wso2.carbon.user.core.listener.UserOperationEventListener"/>

This change allowed me to block the invalid authentication check. We are anyway adding that check from our code side.




回答3:


There is a line in the above logs saying that SP tenant is not equal to user tenant and SP is not SaaS. Are the SP and users are from different tenants? Normally users cannot access SP across different tenants.

If you want to make the SP accessible across different tenants then you need to enable SaaS application option in the SP. Check this doc to learn more about SaaS application https://docs.wso2.com/display/IS530/Adding+and+Configuring+a+Service+Provider



来源:https://stackoverflow.com/questions/60150158/provided-authorization-grant-is-invalid-error-while-trying-to-login-a-dockeriz

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!