-
-
Notifications
You must be signed in to change notification settings - Fork 570
Add Feishu (Lark) to the list of supported providers #2097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hints
Docs (English avaliable)Feishu
LarkLark Suite is the global version of Feishu. It seems that all the docs are almost the same as above. The API host is changed to
Current ImplementationWhat I Did
I assume that Feishu and Lark can be two different environments, so I added two environments to the XML configuration. I tried naming them Tip Question 1: Is it property to name them as
Their token request requires a
Hence, I provided a setting to allow the user code to set the The header value is set in
They respond the token request with a non-standard JSON, so I extracted the error code and successful data in
They also return a nested data object, which will be handled in
They use a different token endpoint when refreshing tokens, which will be handled in Issues not Fixed WellWhen users deny an authorization request, they do redirect back with a http://localhost:49152/callback/login/feishu?error=access_denied If I append the http://localhost:49152/callback/login/feishu?state=G_8BHA5dv*******************hobtjP5Nw&error=access_denied but they will redirect back with an empty http://localhost:49152/callback/login/feishu?code=ca0i847***************31fqhi25u&state= This breaks the normal authorization flow. Tip Question 2: How do we deal with it better? |
Hey, Thanks for your PR! I took a look at the docs and Good Lord, that OAuth 2.0 implementation is just terrible. Some companies are really good at inventing their own non-standard horrors 🤣
Using environments is likely not the best option here (as you figured out, we require a We have two options:
What a horrible/non-standard thing... I wanted to kill myself after reading the docs 🤣 Are we sure that "app access token" (or should we use a tenant access tenant, their docs says they are merging the two?!) doesn't expire? If it does expire, we won't be able to use a setting for that, as the provider would stop working after a short time 😭
That works, but the manual mapping is a bit cumbersome. We'll probably want to have an |
We can't do anything on our side, sadly. Feishu/Lark will have to fix their broken implementation to improve things for users. Edit: or maybe we could try an hybrid approach by not removing the openiddict-core/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs Line 1589 in 7194d58
|
OMG, that implementation was fairly standard! Why did they replace it by a completely non-standard thing?! Makes no sense at all... Do we know if they plan to phase their deprecated APIs out? Edit: 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 |
Both of them are organized by ByteDance, but I am not familiar with their internal management. According to information on search engines, it seems that Lark was published to the Global market except for China mainland earlier. After half a year, they published the China mainland version with a new name - Feishu. Based on my observations of the documentation and management console for both products, I am inclined to believe that they are the same product, just deployed in different regions to serve different regions. Hence, I prefer to provide a setting of If the provider is named Feishu, should we consider the
The
Yes, the docs say they are merging of them with a single
It means that the setting should be a static value instead of a dynamic one. So, do we have a better way to support it? Or we are not able to achieve it at present.
If we can solve the |
# Conflicts: # src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs
Since it seems Lark was released first, I guess it makes sense to name it
If we wanted to support that, we'd need to acquire that stupid app token before making the token request using an Another option - my favorite to be honest - would be to ignore the deprecation and target the old - standard! - API that doesn't require any of the workarounds we need with the "new" version. If they ever decide to remove it, we'll still be able to migrate to the new one at a later date 😃 |
Maybe not, but they should leave the deprecated version still working without breaking legacy applications. The docs say that this deprecated version does not support the For example, if user code applies these scopes: The authorization page will be: which reflects the scopes requested. |
Hum. What happens when targeting the old OAuth 2.0 endpoints (i.e without scope support)? Do you get an unrestricted access? |
Let me take some time to test it out. |
🤣 In this case, let's use the legacy API: if they ever remove it, we'll update both the aspnet-contrib and OpenIddict providers, but in the meantime, the standard OAuth 2.0 API seems to be a much better choice 😄
It's quite frequent. I guess it's a reasonable compromise 😃 Did you have a chance to test the Lark flavor and see if scopes also work with the legacy version? |
Nice, I will update the codes to apply these suggestions.
So we have to accept that denying does not work because the legacy version is a better choice from an overall perspective. 👍
Yes, I tested Lark as well, scopes of which also work with the legacy version. |
(If I use the Feishu client_id and client_secret to create authorization demands on Lark endpoints: The page shows my Feishu authentication credentials do not have permissions for the app created by my Lark account. Now, I may reasonably assume that their data are not completely separated and isolated. |
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml
Outdated
Show resolved
Hide resolved
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml
Show resolved
Hide resolved
Merged, thanks for your contribution! 🎉 |
Thanks for your help! ❤️ |
This pull request would like to add Feishu (Lark) to the list of supported providers, which is also supported by AspNet.Security.OAuth.Providers - Feishu.