nicohman / wyvern

A simple CLI client for installing and maintaining linux GOG games
GNU General Public License v3.0
86 stars 5 forks source link

Interactive login? #8

Closed sigboe closed 5 years ago

sigboe commented 5 years ago

Would it be feasible to have an interactive login method? Also supporting entering the pin if you log in from a new IP address.

I looked slightly into using curl to do this, but I didn't look into it thoroughly. I tried something like this https://github.com/sigboe/glaxy-pie/blob/a54c57eb437fe9e02c409c2a3b6097d2df2133fd/galaxy-pie.sh#L85-L95

nicohman commented 5 years ago

I looked into this, but as far as I can tell, you do need to actually visit the webpage to make the request, so there would need to be a terminal-based web browser as you observed. The only issue is that none of the popular terminal web browsers like w3m or elinks really look like it'd be easy to actually pull the current url from a session, which is what would need to happen. It's possible, but I'm not sure of exactly how to do it.

sigboe commented 5 years ago

The code is also in the HTML of the site after you log in. Not only in the address line. Conveniently its even a json string.

Note the code below is not valid, since I made a new code with the same length.

<html>
<head></head>
<body>
    <script src="//www4-static.gog.com/js/security-ffb517c.js" crossorigin="anonymous"></script>
<script>
    var gogData = {"anonymous_personalization":true,"currentCurrency":{"code":"NOK","symbol":"kr"},"availableCurrencies":[{"code":"NOK","symbol":"kr"},{"code":"EUR","symbol":"\u20ac"},{"code":"USD","symbol":"$"}],"currentLanguage":"en-US","availableLanguages":[{"code":"en-US","name":"English"},{"code":"de-DE","name":"Deutsch"},{"code":"fr-FR","name":"fran\u00e7ais"},{"code":"pl-PL","name":"polski"},{"code":"ru-RU","name":"\u0440\u0443\u0441\u0441\u043a\u0438\u0439"},{"code":"zh-Hans","name":"\u4e2d\u6587(\u7b80\u4f53)"}],"dateFormats":{"tiny":"d MMM"},"now":1549969400,"nowAtom":"2019-02-12T13:03:20+02:00","currentCountry":"NO","personalizationEndpointCacheTtl":0,"deprecatedClientVersion":"1.2.35"};
    function purgeHTTPSUserDataCache() {
        localStorage.removeItem('userData');
        localStorage.removeItem('userDataExpires');
    }

            if (window.gogTools && window.gogTools.saveLoginData) {
            window.gogTools.saveLoginData('Login');
        }

    if (gogData.personalizationEndpointCacheTtl) {
        purgeHTTPSUserDataCache();
    }

        var parentWindow = window.parent;
        if (parentWindow) { parentWindow.postMessage(JSON.stringify({"action":"Auth.AuthCode","data":{"query":{"code":"UZlKzJFRwPlylhhqeJ1PSRORx8wQhL5LwQX6FwE0mQPmMgK81EmPPE3czM5bqC8nVk3ISlxzeP6n2GzmXOMQzWejDFyWETmIFc42Oxs3Db0brY4DqfZey8ffh2kWgbchOeil9XhlIJAS67xOFVMqdeOH8aiEdjoAbao5fbj7muPe"}},"receiver":"galaxyClient"}), '*'); }

    </script>
</body>
</html>
sigboe commented 5 years ago

For completeness sake, making it easier to refer to the login pages, and look at element names.

Here is the source of the login page: (I don't have the source of the two factor page right now, since I cant reproduce that page without GOG feeling its necessary, will post it next time I see it )

<!DOCTYPE html><html lang="en-US"><head><meta charset="utf-8"><title>Login ● GOG.com</title><meta name="viewport" content="width=device-width, initial-scale=1"><link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600&amp;subset=latin" rel="stylesheet"><link rel="stylesheet" href="//static-login.gog.com/css/a6336e8-44ace39.css"/><script language="javascript" type="text/javascript">
    if (location.protocol == 'http:') {
        location.href = location.href.replace(/^http:/, 'https:')
    }
</script></head><body
    class="_modal "
    data-content-type="loginForm"
><svg width="46" height="42" xmlns="http://www.w3.org/2000/svg" style="display:none;"><symbol id="gog-logo" width="46" height="42"><g fill-rule="evenodd"><path d="M45 38.73528c0 .62805-.26415 1.19073-.6933 1.6032-.42915.40937-1.0176.66152-1.6719.66152H3.3652c-.6543 0-1.24275-.25215-1.6719-.66152-.42915-.41247-.69167-.97515-.6933-1.6032V3.26395c.00163-.62572.26415-1.1884.6933-1.60088.42915-.41014 1.0176-.6623 1.6719-.66307h39.2696c.6543.00078 1.24275.25293 1.6719.66307.42915.41248.6933.97516.6933 1.60088v35.47133zm.0188-37.7946C44.41511.35987 43.5771 0 42.6545 0H3.3455C2.4229 0 1.5849.35988.9812.94067.37588 1.51913 0 2.32553 0 3.20921v35.58002c0 .88524.37588 1.69164.9812 2.2701C1.58489 41.63934 2.4229 42 3.3455 42H42.6545c.92262 0 1.76062-.36066 2.36431-.94067.60532-.57846.9812-1.38486.9812-2.2701V3.2092c0-.88368-.37588-1.69008-.9812-2.26854z"/><path d="M27.97107 34.99377h2.1012l-.00416-7.23603c0-.40683.34405-.7326.77453-.7326l2.14149.01247L32.98828 35l2.04517-.00623-.00914-7.2298c0-.40682.34322-.7326.77287-.7326l2.20784.00624L38.01416 35 40 34.99377V25l-10.01282-.00623c-1.1161 0-2.01611.8456-2.01611 1.8845v8.1155zM24.03092 32.27242c0 .40716-.34644.73365-.7909.73365l-4.43475-.0046c-.44953 0-.80527-.3265-.80527-.72905v-4.53953c0-.40716.35574-.73289.79935-.73289l4.43222.0046c.45291 0 .79935.32574.79935.72675v4.54107zm1.84416-5.38105c0-1.04478-.93286-1.89137-2.07866-1.89137h-5.7186C16.92948 25 16 25.84659 16 26.89137v6.21803C16 34.15495 16.92948 35 18.07782 35h5.7186c1.1458 0 2.07866-.84505 2.07866-1.8906v-6.21803zM6 33.10303c0 1.04435.91895 1.89074 2.05538 1.89074h5.96342V33.0968l-4.5833.00623h-.5754c-.44594 0-.79626-.32967-.79626-.72948v-4.62178c0-.40683.35032-.7326.7878-.7326l5.16716-.00624v-2.01916L8.05538 25C6.91895 25 6 25.8456 6 26.8845v6.21853zM31.89262 7C30.84646 7 30 7.82362 30 8.84006v6.04933c0 1.01719.83954 2.12318 1.8857 2.12318h4.1088v-1.97024l-3.24766-.00449c-.4048 0-.7297-.31838-.7297-.70927l.0069-4.60097c0-.39611.32492-.713.7228-.713l4.57004.00692c.40786 0 .732.32382.732.71396l-.00384 8.56103c0 .39387-.32414.71375-.72816.71375l-7.32072-.00244L30 21h8.10969C39.15124 21 40 20.17937 40 19.1592V8.84005C40 7.82362 39.15124 7 38.10969 7h-6.21707zM26.03092 14.27242c0 .40716-.34644.73365-.7909.73365l-4.43475-.0046c-.44953 0-.80527-.3265-.80527-.72905V9.73289C20 9.32573 20.35574 9 20.79935 9l4.43222.0046c.45291 0 .79935.32574.79935.72675v4.54107zm1.84416-5.38105C27.87508 7.8466 26.94222 7 25.79642 7h-5.7186C18.92948 7 18 7.84659 18 8.89137v6.21803C18 16.15495 18.92948 17 20.07782 17h5.7186c1.1458 0 2.07866-.84505 2.07866-1.8906V8.89137zM7.89046 7C6.84422 7 6 7.82362 6 8.84006v6.04933c0 1.01719.84422 2.089 1.89046 2.089h4.10515v-1.97725H8.7259c-.40943 0-.73283-.31839-.73283-.70927l.00768-4.57923c0-.39611.3234-.70702.72515-.70702l4.54585-.00855c.4102 0 .73283.31689.73283.70702L13.9969 18.29c0 .39387-.32263.71375-.72515.71375L6 19.0123V21h8.10877C15.15271 21 16 20.17937 16 19.1592V8.84005C16 7.82362 15.15271 7 14.10877 7H7.89046z"/></g></symbol></svg><div
    data-content-type="registerForm"
    class="_modal__box   js-modal-box"
><div class="_modal__content-wrapper"><div class="_modal__content-item"><form name="register" method="post" action="/register" data-form-type="registerForm" class="form form--register js-register-form"><?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display: none" xml:space="preserve"><symbol id="gog-logo-filled" preserveAspectRatio="xMidYMax meet" viewBox="0 0 34 31"><path id="logo_v3" class="st0" d="M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7
    v-2.6C18,20.3,17.8,20,17.4,20z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7v-2.6
    C18,20.3,17.8,20,17.4,20z M31.5,0h-29C1.2,0.2,0.2,1.2,0,2.5v25.9c0.2,1.3,1.2,2.4,2.5,2.6h28.9c1.3-0.2,2.4-1.2,2.6-2.6v-26
    C33.8,1.2,32.8,0.2,31.5,0z M11,20H6.6C6.3,20,6,20.3,6,20.6v2.7C6,23.7,6.3,24,6.7,24l4.3,0v2H5.6C4.8,26,4,25.3,4,24.5v-4.8
    C4,18.7,4.8,18,5.7,18H11V20z M12,14.4c-0.1,0.9-0.8,1.6-1.7,1.6H4v-2h5.3C9.7,14,10,13.7,10,13.3V7.7C9.9,7.3,9.6,7,9.2,7H6.7
    C6.3,7.1,6,7.3,6,7.7v2.6C6,10.7,6.3,10.9,6.7,11H9v2H5.6c-0.9,0-1.6-0.7-1.6-1.6V6.6C4,5.8,4.7,5.1,5.6,5h4.8
    c0.9,0,1.6,0.7,1.6,1.6V14.4z M20,24.3c-0.1,0.9-0.8,1.6-1.7,1.7h-4.7c-0.9-0.1-1.6-0.8-1.6-1.7v-4.7c0-0.9,0.7-1.6,1.6-1.7h4.7
    c0.9,0.1,1.6,0.8,1.7,1.7V24.3z M19.4,13h-4.8C13.7,13,13,12.2,13,11.4V6.6C13,5.8,13.7,5,14.6,5h4.7c0.9,0,1.6,0.8,1.7,1.6v4.7
    C21,12.2,20.3,13,19.4,13z M30,26h-2v-6h-1c-0.3,0-0.5,0.3-0.5,0.6V26h-2v-6h-1c-0.3,0-0.6,0.3-0.5,0.6V26h-2v-6.3
    c0.1-0.9,0.8-1.6,1.7-1.7H30V26z M30,14.4c-0.1,0.9-0.8,1.6-1.6,1.6H22v-2h5.4c0.3,0,0.6-0.2,0.6-0.6h0V7.6C28,7.3,27.7,7,27.4,7
    h-2.8C24.2,7,24,7.3,24,7.7v2.8c0,0.3,0.3,0.6,0.6,0.6H27v2l-3.4,0C22.7,13,22,12.2,22,11.4V6.6c0-0.9,0.7-1.6,1.6-1.6h4.8
    c0.9,0,1.6,0.7,1.6,1.6V14.4z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7v-2.6
    C18,20.3,17.8,20,17.4,20z M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7v-2.6
    C18,20.3,17.8,20,17.4,20z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7v-2.6
    C18,20.3,17.8,20,17.4,20z"/></symbol></svg><h2 class="form__title"><svg class="gog-logo"><use xlink:href="#gog-logo"></use></svg><div class="form__title--text">Sign-up</div></h2><ol class="form__fieldset"><li class="form__field field  "><label for="register_username" class="required">Username</label><input type="text" id="register_username" name="register[username]" required="required" placeholder="Username" class="field__input" autocomplete="on" required="required" data-error="error_register_username" data-input-type="user" /><span id="error_register_username" class="js-error-msg field__msg is-hidden">Username required</span><span data-error-type="exists" class="js-ajax-error-msg field__msg is-hidden">Username already taken</span><span data-error-type="illegal_chars" class="js-ajax-error-msg field__msg is-hidden">Forbidden special characters</span><span data-error-type="short" class="js-ajax-error-msg field__msg is-hidden">Username too short</span><span data-error-type="long" class="js-ajax-error-msg field__msg is-hidden">Username too long</span></li><li class="form__field field  "><label for="register_email" class="required">Email</label><input type="email" id="register_email" name="register[email]" required="required" class="field__input" autocomplete="on" required="required" placeholder="Email" data-error="error_register_email" data-input-type="user" /><span id="error_register_email" class="js-error-msg field__msg is-hidden">Incorrect email</span><span data-error-type="exists" class="js-ajax-error-msg field__msg is-hidden">Email address already used</span><span data-error-type="invalid" class="js-ajax-error-msg field__msg is-hidden">Incorrect email</span></li><li class="form__field field  "><label for="register_password" class="required">Password</label><input type="password" id="register_password" name="register[password]" required="required" placeholder="Password" class="field__input" autocomplete="on" required="required" data-error="error_register_password" data-input-type="user" /><span id="error_register_password" class="js-error-msg field__msg is-hidden">Password required</span></li></ol><ol class="form__fieldset form__fieldset--agreements"></ol><p class="form__description">
                By signing up you acknowledge you are 13 or older and accept <a href="https://www.gog.com/support/policies" target="_top"><strong>GOG User Agreement & Privacy Policy</strong></a>.
            </p><ol class="form__fieldset"><li class="form__field field btn-slot"><button type="submit" id="register_register" name="register[register]" class="btn btn--main">Sign up now</button></li></ol><div class="form__separator"><span class="form__separator-text">or</span></div><div class="form__buttons-container"><div class="l-section btn-slot"><a
    class="btn btn--facebook ext-acc-fb-redirecting-login is-hidden"
    data-url="/login_process"
>Continue with facebook</a><a
    class="btn btn--facebook ext-acc-fb-popup-login"
    data-url="https://external-accounts-galaxy.gog.com/login/providers/facebook/init"
>Continue with facebook</a></div></div><input type="hidden" id="register__token" name="register[_token]" value="KFpmCJfJbMgXiTPAGf-ITb6FsDX_F91ycPq734-DlD8" /></form><footer class="footer"><a
            class="footer__link js-change-content"
            data-content-type="loginForm"
        >
            Log in to your account
        </a></footer><button
                        selenium-id="loginPopupClose"
                        class="_modal__control js-close-modal"
                        data-action="close"
                    ><i class="icn icn--close"></i></button></div></div></div><svg width="46" height="42" xmlns="http://www.w3.org/2000/svg" style="display:none;"><symbol id="gog-logo" width="46" height="42"><g fill-rule="evenodd"><path d="M45 38.73528c0 .62805-.26415 1.19073-.6933 1.6032-.42915.40937-1.0176.66152-1.6719.66152H3.3652c-.6543 0-1.24275-.25215-1.6719-.66152-.42915-.41247-.69167-.97515-.6933-1.6032V3.26395c.00163-.62572.26415-1.1884.6933-1.60088.42915-.41014 1.0176-.6623 1.6719-.66307h39.2696c.6543.00078 1.24275.25293 1.6719.66307.42915.41248.6933.97516.6933 1.60088v35.47133zm.0188-37.7946C44.41511.35987 43.5771 0 42.6545 0H3.3455C2.4229 0 1.5849.35988.9812.94067.37588 1.51913 0 2.32553 0 3.20921v35.58002c0 .88524.37588 1.69164.9812 2.2701C1.58489 41.63934 2.4229 42 3.3455 42H42.6545c.92262 0 1.76062-.36066 2.36431-.94067.60532-.57846.9812-1.38486.9812-2.2701V3.2092c0-.88368-.37588-1.69008-.9812-2.26854z"/><path d="M27.97107 34.99377h2.1012l-.00416-7.23603c0-.40683.34405-.7326.77453-.7326l2.14149.01247L32.98828 35l2.04517-.00623-.00914-7.2298c0-.40682.34322-.7326.77287-.7326l2.20784.00624L38.01416 35 40 34.99377V25l-10.01282-.00623c-1.1161 0-2.01611.8456-2.01611 1.8845v8.1155zM24.03092 32.27242c0 .40716-.34644.73365-.7909.73365l-4.43475-.0046c-.44953 0-.80527-.3265-.80527-.72905v-4.53953c0-.40716.35574-.73289.79935-.73289l4.43222.0046c.45291 0 .79935.32574.79935.72675v4.54107zm1.84416-5.38105c0-1.04478-.93286-1.89137-2.07866-1.89137h-5.7186C16.92948 25 16 25.84659 16 26.89137v6.21803C16 34.15495 16.92948 35 18.07782 35h5.7186c1.1458 0 2.07866-.84505 2.07866-1.8906v-6.21803zM6 33.10303c0 1.04435.91895 1.89074 2.05538 1.89074h5.96342V33.0968l-4.5833.00623h-.5754c-.44594 0-.79626-.32967-.79626-.72948v-4.62178c0-.40683.35032-.7326.7878-.7326l5.16716-.00624v-2.01916L8.05538 25C6.91895 25 6 25.8456 6 26.8845v6.21853zM31.89262 7C30.84646 7 30 7.82362 30 8.84006v6.04933c0 1.01719.83954 2.12318 1.8857 2.12318h4.1088v-1.97024l-3.24766-.00449c-.4048 0-.7297-.31838-.7297-.70927l.0069-4.60097c0-.39611.32492-.713.7228-.713l4.57004.00692c.40786 0 .732.32382.732.71396l-.00384 8.56103c0 .39387-.32414.71375-.72816.71375l-7.32072-.00244L30 21h8.10969C39.15124 21 40 20.17937 40 19.1592V8.84005C40 7.82362 39.15124 7 38.10969 7h-6.21707zM26.03092 14.27242c0 .40716-.34644.73365-.7909.73365l-4.43475-.0046c-.44953 0-.80527-.3265-.80527-.72905V9.73289C20 9.32573 20.35574 9 20.79935 9l4.43222.0046c.45291 0 .79935.32574.79935.72675v4.54107zm1.84416-5.38105C27.87508 7.8466 26.94222 7 25.79642 7h-5.7186C18.92948 7 18 7.84659 18 8.89137v6.21803C18 16.15495 18.92948 17 20.07782 17h5.7186c1.1458 0 2.07866-.84505 2.07866-1.8906V8.89137zM7.89046 7C6.84422 7 6 7.82362 6 8.84006v6.04933c0 1.01719.84422 2.089 1.89046 2.089h4.10515v-1.97725H8.7259c-.40943 0-.73283-.31839-.73283-.70927l.00768-4.57923c0-.39611.3234-.70702.72515-.70702l4.54585-.00855c.4102 0 .73283.31689.73283.70702L13.9969 18.29c0 .39387-.32263.71375-.72515.71375L6 19.0123V21h8.10877C15.15271 21 16 20.17937 16 19.1592V8.84005C16 7.82362 15.15271 7 14.10877 7H7.89046z"/></g></symbol></svg><div
    data-content-type="loginForm"
    class="_modal__box   js-modal-box"
><div class="_modal__content-wrapper"><div class="_modal__content-item"><form name="login" method="post" action="/login_check" data-form-type="loginForm" class="form form--login js-login-form"><?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display: none" xml:space="preserve"><symbol id="gog-logo-filled" preserveAspectRatio="xMidYMax meet" viewBox="0 0 34 31"><path id="logo_v3" class="st0" d="M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7
    v-2.6C18,20.3,17.8,20,17.4,20z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7v-2.6
    C18,20.3,17.8,20,17.4,20z M31.5,0h-29C1.2,0.2,0.2,1.2,0,2.5v25.9c0.2,1.3,1.2,2.4,2.5,2.6h28.9c1.3-0.2,2.4-1.2,2.6-2.6v-26
    C33.8,1.2,32.8,0.2,31.5,0z M11,20H6.6C6.3,20,6,20.3,6,20.6v2.7C6,23.7,6.3,24,6.7,24l4.3,0v2H5.6C4.8,26,4,25.3,4,24.5v-4.8
    C4,18.7,4.8,18,5.7,18H11V20z M12,14.4c-0.1,0.9-0.8,1.6-1.7,1.6H4v-2h5.3C9.7,14,10,13.7,10,13.3V7.7C9.9,7.3,9.6,7,9.2,7H6.7
    C6.3,7.1,6,7.3,6,7.7v2.6C6,10.7,6.3,10.9,6.7,11H9v2H5.6c-0.9,0-1.6-0.7-1.6-1.6V6.6C4,5.8,4.7,5.1,5.6,5h4.8
    c0.9,0,1.6,0.7,1.6,1.6V14.4z M20,24.3c-0.1,0.9-0.8,1.6-1.7,1.7h-4.7c-0.9-0.1-1.6-0.8-1.6-1.7v-4.7c0-0.9,0.7-1.6,1.6-1.7h4.7
    c0.9,0.1,1.6,0.8,1.7,1.7V24.3z M19.4,13h-4.8C13.7,13,13,12.2,13,11.4V6.6C13,5.8,13.7,5,14.6,5h4.7c0.9,0,1.6,0.8,1.7,1.6v4.7
    C21,12.2,20.3,13,19.4,13z M30,26h-2v-6h-1c-0.3,0-0.5,0.3-0.5,0.6V26h-2v-6h-1c-0.3,0-0.6,0.3-0.5,0.6V26h-2v-6.3
    c0.1-0.9,0.8-1.6,1.7-1.7H30V26z M30,14.4c-0.1,0.9-0.8,1.6-1.6,1.6H22v-2h5.4c0.3,0,0.6-0.2,0.6-0.6h0V7.6C28,7.3,27.7,7,27.4,7
    h-2.8C24.2,7,24,7.3,24,7.7v2.8c0,0.3,0.3,0.6,0.6,0.6H27v2l-3.4,0C22.7,13,22,12.2,22,11.4V6.6c0-0.9,0.7-1.6,1.6-1.6h4.8
    c0.9,0,1.6,0.7,1.6,1.6V14.4z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7v-2.6
    C18,20.3,17.8,20,17.4,20z M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7v-2.6
    C18,20.3,17.8,20,17.4,20z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M18.4,7h-2.8C15.3,7,15,7.3,15,7.6v2.6c0.1,0.4,0.4,0.7,0.8,0.8h2.5c0.4-0.1,0.7-0.3,0.8-0.7V7.8
    C19,7.4,18.8,7.1,18.4,7z M17.4,20h-2.8c-0.3,0-0.6,0.3-0.6,0.6v2.6c0,0.4,0.3,0.7,0.6,0.8h2.8c0.3-0.1,0.6-0.4,0.6-0.7v-2.6
    C18,20.3,17.8,20,17.4,20z"/></symbol></svg><h2 class="form__title"><svg class="gog-logo"><use xlink:href="#gog-logo"></use></svg><div class="form__title--text">Log in</div></h2><ol class="form__fieldset"><li class="form__field field  "><label for="login_username" class="required">Email</label><input type="email" id="login_username" name="login[username]" required="required" type="email" placeholder="Email" class="field__input" autocomplete="on" required="required" data-error="error_login_username" data-input-type="user" /><span id="error_login_username" class="js-error-msg field__msg is-hidden">Incorrect email</span></li><li class="form__field field  "><label for="login_password" class="required">Password</label><input type="password" id="login_password" name="login[password]" required="required" placeholder="Password" class="field__input" autocomplete="on" required="required" maxlength="4096" data-error="error_login_password" data-input-type="user" /><span id="error_login_password" class="js-error-msg field__msg is-hidden">Password required</span></li></ol><ol class="form__fieldset form__fieldset--agreements"></ol><ol class="form__fieldset"><li class="form__field field btn-slot"><button type="submit" id="login_login" name="login[login]" class="btn btn--main">Log in now</button></li></ol><div class="form__separator"><span class="form__separator-text">or</span></div><div class="form__buttons-container"><div class="l-section btn-slot"><a
    class="btn btn--facebook ext-acc-fb-redirecting-login is-hidden"
    data-url="/login_process"
>Continue with facebook</a><a
    class="btn btn--facebook ext-acc-fb-popup-login"
    data-url="https://external-accounts-galaxy.gog.com/login/providers/facebook/init"
>Continue with facebook</a></div></div><input type="hidden" id="login_login_flow" name="login[login_flow]" value="default" /><input type="hidden" id="login__token" name="login[_token]" value="tevP_MKt14Ua78cj8RN-jbQ0QOtBIr8D14uP2lGSF9M" /></form><footer class="footer"><a
            class="footer__link js-normal-link"
            data-content-type="requestPasswordForm"
            href="/password/request"
        >
            Password reset
        </a><a
            class="footer__link js-change-content"
            data-content-type="registerForm"
        >
            Sign up now
        </a></footer><button
                        selenium-id="loginPopupClose"
                        class="_modal__control js-close-modal"
                        data-action="close"
                    ><i class="icn icn--close"></i></button></div></div></div><script type="text/javascript" src="//static-login.gog.com/js/2c420b1-44ace39.js"></script><script type="text/javascript" src="//static-login.gog.com/js/7d3cec2-44ace39.js"></script></body></html>
sigboe commented 5 years ago

https://github.com/eddie3/gogrepo/blob/c3f381f5e2216b88689b8bff6ce25be0b30d5e6c/gogrepo.py#L518

Here is someone who did it in python.

nicohman commented 5 years ago

Thanks for that. That'll actually be very helpful as an example. I'll see about if I can finish this on up today, actually.

sigboe commented 5 years ago

I really don't wish to rush you, and I am not demanding anything, but I regret that I am asking you for a status update for this ticket?

nicohman commented 5 years ago

Still working on it, but it is trickier than I expected because of reqwest's cookie jar support being spotty at best. Might be a bit. Sorry for the delay/inconvenience!

sigboe commented 5 years ago

Don't be sorry, I am just impatient :smile:

sigboe commented 5 years ago

@nicohman looks like the other project has some troubles now too, and some workaround

https://github.com/eddie3/gogrepo/issues/39

sigboe commented 5 years ago

@nicohman https://github.com/Kalanyr/gogrepoc/blob/master/gogrepo.py

This fork has solved the API changes to the login

nicohman commented 5 years ago

@sigboe Thanks for that--that actually looks really helpful. Tried it on my machine and it worked, so it's only a question of how it's different. I'll try and work on this this weekend.

sigboe commented 5 years ago

@nicohman I think it has to do with how it stores cookies, if you look at the link I posted 13 days ago, there is a discussion, I havent read it thoroughly

nicohman commented 5 years ago

@sigboe OK, I think I've narrowed down some of what's going on here. First, I've actually been getting blocked by the captcha a lot more than I thought-- I was using the same method as gogrepo, but that appears to actually render the page. In the raw HTML, the captcha is just a script tag. I should now be able to detect it properly. That issue you posted isn't the same issue-- they can properly log in, but can't make requests with that token. Still working on this, but it's slow because I can only test so many times before I hit the captcha. If you want to see what I have so far, it's on the login branch in the gog crate's git repo.

sigboe commented 5 years ago

@nicohman This is awesome, good work thus far!

sigboe commented 5 years ago

BTW, you didn't push the login branch, but I don't understand rust anyway.

Does the token look the same or?

nicohman commented 5 years ago

I pushed it. It's just in the GOG API repo: here

nicohman commented 5 years ago

OK, great news. I successfully got a login code with just username & password. Unfortunately, the captcha got triggered immediately afterwards, but tomorrow I should be able to finish up testing, make sure the requests actually work with it, merge it into the GOG master and update wyvern with the new login method.

sigboe commented 5 years ago

That so great, are you able to writing username and password using like

wyvern login --username sigboe --password whysm1writinthisonhere? 
nicohman commented 5 years ago

Yeah, that could definitely be an option. I'll make sure to add it!

nicohman commented 5 years ago

OK, I've now managed to fetch a list of the games an user owns with username & password login, so all looks good. I've merged the login branch into master, but there are some stability issues where it doesn't appear to work 100% of the time, so I may need to see about fixing that. Plus, I haven't had an opportunity to test that two factor codes work. Once those are finished up, I'll add it to wyvern.

sigboe commented 5 years ago

Please tell me that you are not saving the password :smile:

nicohman commented 5 years ago

Nope. After the request is made, a token identical to the current auth token is saved. It’s effectively just spoofing the current login process. Roughly as secure as what already happens with wyvern.

nicohman commented 5 years ago

Hey, I've got some good news. Finally got around to properly figuring out the two-factor token codes and now have it working with both two-factor and normal logins. I still need to integrate it into wyvern, but interactive login should be done by the end of the week at the latest. Sorry for such a long wait!

sigboe commented 5 years ago

Don't be sorry, I am just happy :)

nicohman commented 5 years ago

Added in 0c84da1. It's still a little buggy so you may need to log in once or twice sometimes, but mostly works pretty well. With this and the dialoguer update, I'm probably going to push a major version bump soon.

sigboe commented 5 years ago

Best national day ever, an update to my favourite way to download from GOG :smile: