小编Neo*_*eok的帖子

尽管提示没有价值,谷歌认证总是要求授权

从Google OAuth连接用户后,如果此用户希望在下一个需要选择其Google帐户的会话期间重新连接,则会再次询问该权限.

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

如果未指定任何值且用户先前未授权访问,则会向用户显示同意屏幕.

因此,用户不必重新排序他的同意(通过验证,该申请存在于我的授权中).

设想的唯一答案是关于这个问题的答案:用谷歌登录总是要求用户同意

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

代码生成URL

/**
 * 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 …
Run Code Online (Sandbox Code Playgroud)

oauth google-api node.js google-oauth

5
推荐指数
1
解决办法
223
查看次数

标签 统计

google-api ×1

google-oauth ×1

node.js ×1

oauth ×1