通过重定向而不是弹出窗口向Google进行身份验证

时间:2018-06-24 15:17:57

标签: javascript google-api

我正在构建一个移动应用程序,我注意到当我将其添加到主屏幕(iOS)时,我无法再通过Google进行身份验证。我单击登录按钮,打开Safari,然后登录,但是它没有将我重定向回该Web应用程序。

仅当我将应用添加到主屏幕并尝试从其进行身份验证时,这种情况才会发生。

我在想是因为弹出窗口。有没有一种方法可以使用重定向方法(而不是弹出窗口)进行身份验证?

现在我正在执行此操作以启动oauth进程:

import glob
from pathlib import Path
import datetime
import re
import csv


get_this = []
thislist = []

def timeteller():
    now = datetime.datetime.now()
    month = str('{:02d}'.format(now.month))
    day1 = now.day -1
    day =  str('{:02d}'.format(day1))
    year =str(now.year)
    time =year+month+day
    return time

def these_files(x, y):

    configfiles = Path('O:/Unit Management/Reports/G4S/').glob('{}*/{}*Transaction.txt'.format(x, y))

    for files in configfiles:
        thislist.append(files)

    return thislist

def hasNumbers(inputString):
    numberfinal = []
    numberfinal = re.findall("\d+", inputString)
    if numberfinal == []:
        numberfinal = '1'
    return numberfinal

def get_odometers(thesepath):

    for thispath in thesepath:

        with open(thispath,"r") as f:
            searchlines = f.readlines()
        for i, line in enumerate(searchlines):
            if "Odometers" in line:
                get_this.append(line)
            elif "Lifetime" in line:
                get_this.append(line)


    return get_this

def make_pretty(checkthis):
    the_numbers = {}
    the_numbers['Serial'] = banumber
    for i, line in enumerate(checkthis):
        the_numbers['Serial'] = banumber
        if '(BNR) Odometers  Accept' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['BNR'] = numberschecked[0]
        elif '(BNR 2) Odometers  Accept' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['BNR 2'] = numberschecked[0]
        elif '(BCR) Odometers  Accept' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['BCR'] = numberschecked[0]
        elif '(BCR) Odometers  Hopper1' in line:
            for l in checkthis[i:i+2]:
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['Hopper1'] = numberschecked[0]
        elif '(BCR) Odometers  Hopper2' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['Hopper2'] = numberschecked[0]
        elif '(BCR) Odometers  Hopper3' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['Hopper3'] = numberschecked[0]
        elif '(BCR) Odometers  Hopper4' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['Hopper4'] = numberschecked[0]
        elif '(BCR) Odometers  Hopper5' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['Hopper5'] = numberschecked[0]
        elif '(BCR) Odometers  Hopper6' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['Hopper6'] = numberschecked[0]
        elif '(BCR) Odometers  Hopper7' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['Hopper7'] = numberschecked[0]
        elif '(BCR) Odometers  Hopper8' in line:
            for l in checkthis[i:i+2]: 
                numbers = l[0:20]
                numberschecked = hasNumbers(numbers)
                the_numbers['Hopper8'] = numberschecked[0]


    return the_numbers

intnow = int(timeteller())
intnow -= 1
now = str(intnow)
thelist = []
thispath = open('banumberlist1.txt')
finallist = []
for files in thispath:
    getem = files
    banumber = getem[0:8]
    print(banumber)
    combined = '{}_{}'.format(banumber,now)
    thepaths = these_files(banumber, combined)
    needtomakepretty = get_odometers(thepaths)
    goeslast = make_pretty(needtomakepretty)
    finallist.append(goeslast)


f = open ('odom01.txt', 'w')
for ba in finallist:
    sba = str(ba)
    f.write(sba)    

0 个答案:

没有答案