Possibility to use social login with a callback to different URL (especially for native iOS/Android clients) #1909
mfreiwald
started this conversation in
Feature Requests & Suggestions
Replies: 2 comments
-
I like the idea of a native iOS app, especially in perspective of changes to PWAs in iOS 17.4 @mfreiwald would #1856 help? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm not 100% sure if this helps. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to create a native iOS app that uses LibreChat as its backend. Right now, only the local login works but no OAuth flow because of missing redirects back to the app.
To make this possible and without big changes in the authorization flow, a
redirect
parameter when calling the OAuth login would be possible. This redirect enables native app developers to use the already implemented OAuth flow and receive the token & refreshToken after successful login.E.g. an iOS developers can use ASWebAuthenticationSession to start the authorization and after a callback to a custom scheme, the tokens from the callback URL can be extracted.
I will use the
openid
endpoint as an example, but it works with all implemented social logins.To keep the redirect URL between the initial call of
oauth/openid
and the callback of the authorizeroauth/openid/callback
, the initial redirect URL will be stored in the state-parameter of the OAuth flow described by the Auth0 documentation: https://auth0.com/docs/secure/attack-protection/state-parametersIn the example following properties will be used:
libre-chat-ios
as the custom scheme for an iOS app that will be used to redirect after the authorization is successful.libre-chat-ios://auth/callback
as the callback URL to return the tokens to the appoauth/openid
as the selected authorizerThe flow would look like this:
https://chat.example.dev/oauth/openid?redirect=libre-chat-ios://auth/callback
state
property when calling the openid endpointhttps://chat.example.dev/oauth/openid/callback
gets calledlibre-chat-ios://auth/callback?token=123&refreshToken=abc
I already implemented a solution for this here: Add redirect parameter to OAuth logins
Beta Was this translation helpful? Give feedback.
All reactions