Sign in #712
|
Hey everyone, I'd like to know how account login works, how rehike interacts with OAuth 2, and how login and interactions on the frontend are made exclusive to logged-in users. I need a detailed explanation! |
Replies: 1 comment 1 reply
|
Rehike doesn't use OAuth2 at all. To my knowledge, that is used by the mobile apps, TV apps, and Data API. We use Google's SAPISIDHASH authentication system, same as regular web YouTube. Since the Rehike server intercepts all YouTube requests, it can just access all cookies that you have stored for the domain. When we make normal requests (non-InnerTube), then we can pass all the user's cookies to the YouTube request and the user will naturally be logged in. The same principle applies to InnerTube requests, but InnerTube requires an The SAPISIDHASH value is a request-time hash generated from the current time of the client, the desired origin, and the user's SAPISID cookie. Rehike/modules/Rehike/Signin/AuthManager.php Lines 118 to 128 in bc584b7 One of the first checks we use to determine if the user is logged in is checking the availability of the SAPISID cookie. If it does not exist, then all additional signin-related code will be skipped. Rehike/modules/Rehike/Signin/AuthManager.php Lines 102 to 116 in bc584b7 If the cookie exists, then we retrieve information about the user's session. Most of this information is retrieved from Rehike/modules/Rehike/Signin/AuthManager.php Lines 169 to 172 in bc584b7 In PHP code, we use the
|

Rehike doesn't use OAuth2 at all. To my knowledge, that is used by the mobile apps, TV apps, and Data API. We use Google's SAPISIDHASH authentication system, same as regular web YouTube.
Since the Rehike server intercepts all YouTube requests, it can just access all cookies that you have stored for the domain. When we make normal requests (non-InnerTube), then we can pass all the user's cookies to the YouTube request and the user will naturally be logged in. The same principle applies to InnerTube requests, but InnerTube requires an
Authorizationheader with a SAPISIDHASH. Once that's supplied, all requests act on behalf of the user account just like Polymer, so we just make analogous req…