This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
get-identities api #583
amitu
started this conversation in
Ideas & RFC
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This API returns answer to queries about currently logged in users.
The input to this api can be one or more identity queries.
We have two kind of identity queries.
Static Identity Query
Say a user is logged in via github, the
github-username
is a static identity query for that user. This does not change for that user (it can theoretically change, but we are not concerned about such rare changes, if username changes maybe the user should logout and log back in).From each authentication providers, we get some sort of unique id of the logged in user. For Login with Google it will be their gmail address. For Facebook it may be a unique fbuid, or maybe we get email from them also. These are all static identities.
All known static identities of a user are sent as response from get-identities api.
Dynamic Identity Query
These are information about the user that can change. Eg in case of github we have
github-like: ftd-lang/fpm
, which is satisfied by the currently logged in user only if they have liked it or not. This information can change often, so we want to find out if currently logged in user has liked the repo on every request.Note: We may actually not make an HTTP request to Github asking if currently logged in user has liked the repo or not on every request to get-identities api, and cache this information for a while, say 10mins as an optimisation. But for the purpose of this discussion lets assume there is no caching.
Each auth provider supports a different set of identity queries. Eg Github may tell us if someone has like a repo or not. Or Google may tell us if someone has write access to some Google Doc or not. Or telegram may tell us if someone belongs to a telegram chat room or not.
Since these queries require an API call to external service, and also since the universe of queries is infinite (there can be an infinite number of repos you could have liked or documents you have access to), so we can not send answer to all possibly dynamic queries, and therefor we only send the result of dynamic queriers you asked for.
Examples
Say the request was:
/api/get-identities/
, and user is logged in via github and gmail, we return the following:Say, the request was to
/api/get-identities/?github-likes=ftd-lang/ftd
butfoo
(the currently logged in user) has not likedfid-lang/ftd
yet, the response would still be:But if
foo
had likedfid-lang/ftd
repo already, the response will be:Please note that we have sent it as a list. Since github-likes can be passed multiple times as well:
/api/get-identities/?github-likes=ftd-lang/ftd&github-likes=ftd-lang/fpm
:Assume
foo
has liked both these repos.Beta Was this translation helpful? Give feedback.
All reactions