Skip to content
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

How to determine your unique user ID #4

Open
bgreenwell opened this issue Mar 5, 2018 · 14 comments
Open

How to determine your unique user ID #4

bgreenwell opened this issue Mar 5, 2018 · 14 comments

Comments

@bgreenwell
Copy link

Wasn't sure how you guys were able to accomplish this? Any help would be truly appreciated!

@cryogenx
Copy link

did you ever figure this out?

@bgreenwell
Copy link
Author

I did, by using the Google Chrome extension. Is that currently the easiest way?

@jpoles1
Copy link

jpoles1 commented Apr 3, 2018

Best way that I've figured out how to do it. Would love to know if there is another (easier) way.

@ohabash
Copy link

ohabash commented May 17, 2018

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?

@jpoles1
Copy link

jpoles1 commented May 17, 2018

@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

@bgreenwell
Copy link
Author

bgreenwell commented May 17, 2018

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!

@jpoles1
Copy link

jpoles1 commented May 18, 2018

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

@ohabash
Copy link

ohabash commented May 18, 2018

@jpoles1 do you know how that request works?

@ohabash
Copy link

ohabash commented May 18, 2018

  # 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

@bgreenwell
Copy link
Author

Roping in @j-c-o-l-l-i-n-s who made the PR for RBitmoji just in case he has any insights here!

@ohabash
Copy link

ohabash commented May 18, 2018

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']```

@j-c-o-l-l-i-n-s
Copy link

@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.

@jpoles1
Copy link

jpoles1 commented May 20, 2018

Absolutely brilliant @j-c-o-l-l-i-n-s !

@davidsilvasmith
Copy link

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?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants