Open bgreenwell opened 6 years ago
did you ever figure this out?
I did, by using the Google Chrome extension. Is that currently the easiest way?
Best way that I've figured out how to do it. Would love to know if there is another (easier) way.
I am also interseted in easy ways to for my users to get their uid... How do you guys do it with the chrome extension?
@ohabash I do it by dragging any of the bitmoji in the chrome extension into a new tab. You can also right click on an image and open it in a new tab. I find that the IDs from these urls can take at least two different forms:
128257004_1_s1 934d9900-892a-4515-8beb-202d6c42a6ee
See our RBitmoji project
https://github.com/koalaverse/RBitmoji
Someone just made a pull request that makes getting your user id a piece of cake with only knowing your username and password!! Shouldn’t be hard to extend to other languages!
Thanks for the info @bgreenwell!
Looks like the current methodology involves making a request to https://api.bitmoji.com/user/login and getting the user-id in the response
@jpoles1 do you know how that request works?
# attempt to login --------------------------------------------------------
login_url = 'https://api.bitmoji.com/user/login'
login_response <- httr::POST(url = login_url
, httr::add_headers(
Accept = "application/json"
, "Accept-Encoding" = "gzip, deflate, br"
, "Accept-Language" = "en-US,en;q=0.9"
, Connection = "keep-alive"
, "Content-Type" = "application/x-www-form-urlencoded"
, Host = "api.bitmoji.com"
, Origin = "https://www.bitmoji.com"
, Referer = "https://www.bitmoji.com/account_v2/"
)
, body = list(
client_id = "imoji"
, username = user_email
, password = getPass::getPass(msg = "PASS")
, grant_type = "password"
, client_secret = "secret"
)
, encode = "form"
)
wondering how to get this into js or postman
Roping in @j-c-o-l-l-i-n-s who made the PR for RBitmoji just in case he has any insights here!
How did you guys get api accounts?
https://rocketgit.com/user/gdr/bitmoji/source/tree/branch/master/blob/update_json.py
headers = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36",
"Content-Type": "application/json",
}
body = {
"client_id":"imoji",
"username":username,
"password":password,
"grant_type": "password",
"client_secret":"secret"
}
r = requests.post(
"https://api.bitmoji.com/user/login",
headers=headers,
data=json.dumps(body),
)
r.raise_for_status()
response = r.json()
return response['access_token']```
@ohabash I do not have an api account. I simply opened Chrome Developer tools while I logged into bitmoji.com through Google Chrome to examine the login, avatar, and logout HTTP requests. The login_response
from above is collecting a token after authenticating with username/password that is then used to capture the bitmoji unique user id in the avatar_response
call:
avatar_response <- httr::GET(
url = avatar_url,
httr::add_headers(
"Accept-Encoding" = "gzip, deflate, br",
"Accept-Language" = "en-US,en;q=0.9",
"bitmoji-token" = token,
Connection = "keep-alive",
"Content-Type" = "application/x-www-form-urlencoded",
Host = "api.bitmoji.com",
Origin = "https://www.bitmoji.com",
Referer = "https://www.bitmoji.com/account_v2/"
)
)
All other headers besides bitmoji-token
in the httr::add_headers(...)
are just to emulate real user behavior that would occur by login through Chrome.
I would envision that users would use get_id
once and then place the token into .Renviron
so an api account for each user may not be necessary unless the user is creating high-volume requests using plot_comic
or get_comic
Let me know if you have any other questions on the structure of the calls.
Absolutely brilliant @j-c-o-l-l-i-n-s !
I love the work ya'll are doing!
I noticed in the iOS keyboard extension there is a way to use the friendmojis and it works by listing friends and picking one. I'm guessing there must be an API call to get friends.
Maybe that will be helpful in finding friend ids?
Wasn't sure how you guys were able to accomplish this? Any help would be truly appreciated!