微信小程序如何通过账号密码较验登陆gmail邮箱
发布于 5 年前 作者 nqian 6878 次浏览 来自 问答

需要验证用户身份,公司使用gmail邮箱,

现在通过小程序实现验证gmail账号功能,

原本用如下代码可以测试自己的账号,后来用同事账号都较验不过,不知道为什么,是不是我自己账号的安全关了,同事的没有关,大家有没有更好的方法来较验google登陆账号

        mail = poplib.POP3_SSL(‘pop.gmail.com’);

        mail.user(str(email));

        mail.pass_(str(password));

        ret = mail.stat();

        print str(ret)

        retR = re.compile(’\(\d*,\s*\d*’);

        if (retR.match(str(ret))):

            print “True”;

            return True;

        else:

            print “False”;

            return False;


1 回复

时间紧急,没有时间了,只能想了个比较笨的办法,抓取异常,如果大家有更好的办法也可回贴

    except  Exception as e:

        output = str(e)

        print output

        if (output.find(“Username and password not accepted”)!=-1):

            print “False”

            return False;

        if(output.find(“Application-specific password required”)!=-1):

            print “True”

            return True;

回到顶部