Closed tumluliu closed 1 month ago
The reason I hardcoded that redirectUri
is because users most probably want to be redirected back to the app once they login. So, may I know why you want to customize the url? As of now, it is not customizable, but I can make it customizable if there is a usecase for that particular feature.
@fa-fifi Thanks for your reply. Interesting, I was not aware that the token exchange could also be done from the mobile client side. But anyway, as of now the "code-to-token" exchange action is done in our server-side API by an endpoint like https://OUR_BE_HOST/api/auth/callback
which apparently doesn't follow the pattern $bundleIdentifier://login-callback
. We need to call this endpoint to get an Authorization access_token
in order to call some specific endpoints that only logged-in users can access (imagine sth. like user browsing history, etc.).
I'm open to change the token exchanging from server-side to client-side. Then the question becomes: how to handle this token exchanging with keycloak_wrapper
. I haven't seen this part from your example. Could you please provide some further hints? Thanks.
am I supposed to use this accessToken
?
Yup. Once you logged in, you will receive an accessToken
that can be used to access your resources. If you need to customize the url just because you want to get the accessToken
, then you should be using the one provided by the package.
Try that first and see if it's working or not.
UPDATE: we managed to successfully utilize the accessToken
without the necessity to customize the redirectURI. Thanks for your kind support, @fa-fifi !
Hi, thank you for making such a simple and elegant wrapper! I have one question regarding the
redirectUri
from theKeycloakConfig
. It seems that it's hardcoded as a combination of thebundleIdentifier
and://login-callback
. But in our case, this redirectUri is a link likehttps://OUR_BE_HOST/api/auth/callback
. So my question is: is it possible to customize thisredirectUri
?https://github.com/fa-fifi/keycloak_wrapper/blob/0c58aecd9e3c7f06a234056a173a781549394423/lib/src/config.dart#L42-L51
Thank you again