这真是一个夜魇.我不知道为什么我在过去24小时内得到这个.任何帮助非常感谢请.
SERVER -> CLIENT: 220 smtp.gmail.com ESMTP w23sm28778307wmd.1 - gsmtp
CLIENT -> SERVER: EHLO cslexicon.tk
SERVER -> CLIENT: 250-smtp.gmail.com at your service, [31.170.164.33]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
CLIENT -> SERVER: EHLO cslexicon.tk
SERVER -> CLIENT: 250-smtp.gmail.com at your service, [31.170.164.33]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
CLIENT -> SERVER: AUTH XOAUTH2 dXNlcj1zc3Nzc2F0aHlhYTY3QGdtYWlsLmNvbQFhdXRoPUJlYXJlciB5YTI5LmFRS2E2OC1qUmZsenhhYnE1YmkxNWlYcUtOa1VmTjdJZ3NBT2dLYU1uekhpR2I0NVV4dm9GNWozcDZoZGp3LXZtTjEyVEEBAQ==
SERVER -> CLIENT: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
SMTP ERROR: AUTH command failed: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
SMTP Error: Could …Run Code Online (Sandbox Code Playgroud) 升级到Keycloak版本1.9.1后,我们开始keycloak.js在获取基于代码的令牌时遭到拒绝.
如果我们输入基本URL(http://example.com),那么应用程序正常工作,登录成功并检索令牌.
不幸的是,当进入这个子页面时(https://example.com/?redirect_fragment=/asset-library/card-view/ - 它是从带有redirect_fragment编码的javascript发送的,但是在keycloak日志中,这个片段被解码后可见)我们得到了成功登录并获取代码后获取令牌时出错400.准确的反应是:
{
"error_description": "Incorrect redirect_uri",
"error":"invalid_grant”
}
Run Code Online (Sandbox Code Playgroud)
这是为什么?在有效的重定向uri in keycloak中我们有(以防万一):
- https://example.com*
- https://example.com/*
- https://example.com/?redirect_fragment=/asset-library/card-view/
- https://example.com/?redirect_fragment=%2Fasset-library%2Fcard-view%2F
- http://example.com*
- http://example.com/*
- http://example.com/?redirect_fragment=/asset-library/card-view/
- http://example.com/?redirect_fragment=%2Fasset-library%2Fcard-view%2F
Run Code Online (Sandbox Code Playgroud)
以下是使用重定向URI beeing http://example.com成功登录的日志:
11:38:47,934 DEBUG [org.jboss.jca.core.connectionmanager.pool.validator.ConnectionValidator] (ConnectionValidator) Notifying pools, interval: 30000
11:38:47,935 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ConnectionValidator) Checking for connection within frequency
11:38:47,936 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ConnectionValidator) Returning for connection within frequency
11:38:47,937 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ConnectionValidator) Checking for connection within frequency
11:38:47,938 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ConnectionValidator) Returning for …Run Code Online (Sandbox Code Playgroud) 在尝试查找身份验证系统以向Web服务添加社交登录时,我有一些关于我应该使用的问题.我的要求是:
OpenID Connect听起来很合适,但我的理解是Facebook不支持它.
OAuth2通过有时称为反向流的方式提供解决方案.对于Web应用程序来说这似乎很好,但我不认为恶意用户可能会从其他应用程序中获取令牌并使用它们来冒充用户.我的理解是,这尤其是Client/Implicit Flow的一个问题.
有没有办法在移动应用程序中保护客户端的秘密?更具体地说,我可以在移动应用程序上实现一些东西,允许我在接受之前检查我的服务实际上是任何令牌的目标受众吗?
还有关于客户端ID /客户端密钥的第二个问题:
客户端将从授权服务器获取用户ID或电子邮件,并将其作为标识手段发送到后端,但后端需要验证这一点.为此,我想知道我还必须向后端发送什么?访问令牌?我是否在客户端和后端的授权服务器上使用相同的客户端ID和客户端密钥,以允许后端验证访问令牌?
因此,使用授权授予类型的基本OAuth2流通常如下进行操作(例如,假设OAuth Client = Quora,OAuth Server = Google):
现在,如果用户已经登录说“服务器先”,然后尝试访问“客户端”,
我正在尝试在使用 OAUTH2 身份验证的 api 上使用 RequestsLibrary。
身份验证通过 OAUTH2 进行,凭据提供给 /v1/authtoken 端点。对 APÍ 的后续调用需要将令牌作为“承载”包含在 http 请求的“授权”标头中。
所以下面是测试用例。我得到的错误是: 401 != 200
凭据在 jmeter 中工作正常,并返回帐户列表。但是,我无法使 RF 脚本工作。任何帮助将不胜感激。
在剧本中,
${accessToken}返回访问令牌:8ETFXTZOWQLrgsMj7c_KuCEeypdj-eO1r...${token}返回:Bearer 8ETFXTZOWQLrgsMj7c_KuCEeypdj-eO1r...*** Test Cases ***
Get authToken
Create Session hook http://xxxx.azurewebsites.net verify=${True}
${data}= Create Dictionary grant_type=client_credentials client_id=yyy-zzzz client_secret=xxxxxxxxxxxxxxx
${headers}= Create Dictionary Content-Type=application/x-www-form-urlencoded
${resp}= post request hook /v1/authtoken data=${data} headers=${headers}
Should Be Equal As Strings ${resp.status_code} 200
Dictionary Should Contain Value ${resp.json()} bearer
${accessToken}= evaluate $resp.json().get("access_token")
Log to Console ${accessToken} …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试使用OAuth2授权我的用户.我目前正在使用以下库:https://github.com/p2/OAuth2
let oauth2 = OAuth2CodeGrant(settings: [
"client_id": "my-id",
"authorize_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://www.googleapis.com/oauth2/v3/token",
"scope": "profile", // depends on the API you use
"redirect_uris": ["com.TestAuthorizeApp:/oauth2Callback"],
])
//let oauth2 = OAuth2CodeGrant(settings: settings)
oauth2.onAuthorize = { parameters in
print("Did authorize with parameters: \(parameters)")
}
oauth2.onFailure = { error in // `error` is nil on cancel
if let error = error {
print("Authorization went wrong: \(error)")
}
}
oauth2.authConfig.authorizeEmbedded = false
oauth2.authorize()
Run Code Online (Sandbox Code Playgroud)
当我运行它时,它在浏览器中加载谷歌,我能够登录.然后它询问我在范围内声明的权限,并且工作正常.我点击确定打开,它将我重定向回我的应用程序.
但是,当我再次运行此代码时,我希望访问令牌已存储在密钥链中.然而,这似乎不起作用.
我查看了源代码并找到了以下检查:tryToObtainAccessTokenIfNeeded总是返回false.这意味着我再次获取页面,我需要单击"允许".
我想知道是否有人可以帮我弄清楚为什么它不能保存钥匙串中的任何东西.这是否意味着用户并未真正进行身份验证?
谢谢.
===
编辑
oauth2.verbose …
我在用 nodejs+express 编写的服务中使用谷歌登录,并使用passport-google-oauth 登录谷歌。在我的网站上,我有一个“使用 Google 登录”按钮。我想要的是在用户点击此按钮时始终显示谷歌登录或帐户选择器。相反,如果我在浏览器中恰好使用一个 google 帐户登录,我会立即使用该帐户登录以使用服务。我在定义 GoogleStrategy 时尝试过这样的事情:
passport.use(new GoogleStrategy({
clientID: GOOGLE_CLIENT_ID,
clientSecret: GOOGLE_CLIENT_SECRET,
callbackURL: REDIRECT_URL,
passReqToCallback : true,
prompt: 'select_account' // <--!!!
}, function(req, accessToken, refreshToken, profile, done) {
//callback stuff
})
})
Run Code Online (Sandbox Code Playgroud)
但它似乎不起作用。
不确定哪种CSRF攻击会阻止OpenID Connect服务器流中的“状态”参数。有人可以给我一个例子吗?
我正在努力让Google Identity Toolkit API适用于基于PHP的应用程序.
我一直在关注Google提供的快速入门指南:https: //developers.google.com/identity/toolkit/web/quickstart/php
我完全按照步骤(并检查和双重检查).
登录按钮显示在index.php页面上.单击此按钮可重定向到该widget.php页面.我可以选择要登录的帐户,然后在返回到成功登录页面时(index.php再次),我收到以下错误消息:
致命错误:未捕获的异常"Google_Auth_Exception",并显示消息"刷新OAuth2令牌时出错,消息:'{"error":"invalid_client","error_description":"OAuth客户端无效." }"
我尝试在Google Developer Console中重新创建OAuth客户端.检查电子邮件和项目名称字段时提到的一些搜索结果已在OAuth同意屏幕上完成,所有这些都是我完成的.
任何帮助和建议将不胜感激.注意:我只使用Identity Toolkit API设置下的可用提供程序中的"Google".
我的index.php页面:
<!DOCTYPE html>
<html>
<head>
<!-- 1: Load the Google Identity Toolkit helpers -->
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ .'/vendor/google/apiclient/src');
require_once __DIR__ . '/vendor/autoload.php';
$gitkitClient = Gitkit_Client::createFromFile(dirname(__FILE__) . '/gitkit-server-config.json');
$gitkitUser = $gitkitClient->getUserInRequest();
?>
<!-- End modification 1 -->
<script type="text/javascript" src="//www.gstatic.com/authtoolkit/js/gitkit.js"></script>
<link type=text/css rel=stylesheet href="//www.gstatic.com/authtoolkit/css/gitkit.css" />
<script type=text/javascript>
window.google.identitytoolkit.signInButton(
'#navbar',
{
widgetUrl: "/gitkit",
signOutUrl: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用带有Python的Google Drive API(v3)来获取文件并将其上传到我的Google云端硬盘帐户.
我使用本指南设置了我的身份验证:https://developers.google.com/drive/v3/web/quickstart/python
但是对于我的程序,我想对username,filename和output_filename进行命令行输入.我修改了谷歌文档代码并执行了以下操作:
from __future__ import print_function
import httplib2
import os
from sys import argv
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from apiclient.http import MediaIoBaseDownload, MediaIoBaseUpload
import io
try:
import argparse
parser = argparse.ArgumentParser(description="I want your name, the file ID, and the folder you want to dump output to")
parser.add_argument('-u', '--username', help='User Name', required=True)
parser.add_argument('-f', '--filename', help='File Name', required=True)
parser.add_argument('-d', '--dirname', help = 'Directory Name', …Run Code Online (Sandbox Code Playgroud) oauth2 ×10
argparse ×1
csrf ×1
facebook ×1
frameworks ×1
gmail ×1
google-login ×1
ios ×1
javascript ×1
jboss ×1
keychain ×1
keycloak ×1
node.js ×1
oauth ×1
passport.js ×1
php ×1
python ×1
security ×1
swift ×1
username ×1