Google身份验证始终要求授权

时间:2018-08-28 23:09:55

标签: oauth google-api google-oauth

从Google OAuth连接用户后,如果该用户希望在需要选择其Google帐户的下一个会话期间重新连接,则会再次请求许可。

根据documentation,负责授权请求的参数提示的行为如下:

  

如果未指定任何值并且用户先前未授权   访问,然后向用户显示一个同意屏幕。

因此,用户不必重新排列其同意书。

唯一能想到的答案是关于这个问题的答案:login with google always asks user consent

因为我也没有安全的HTTP在本地工作,但他认为存在cookie策略,而事实并非如此。

如何解决此异常?

编辑:

/**
 * Create a new OAuth2Client with the credentials previously loads
 */
private getOAuth2() : OAuth2Client {
    return new OAuth2(
        this.credentials.client_secret,
        this.credentials.client_id,
        this.credentials.redirect_uris[0]
    );
}

/**
 * Create connection URL for the given scopes
 * @param scopes
 */
public url(scopes: Array<string>) : string {
    return this.client.generateAuthUrl({
            access_type: "offline",
            scope: scopes
    });
}



// The scope used to generate URL is 'https://www.googleapis.com/auth/youtube.readonly'

// this.client refer to a client which is load by getOAuth2
// and use only for the generation of URL's.

0 个答案:

没有答案
相关问题