问题描述
我有keylcoak的本地实例,我正尝试将Flutter应用程序连接到它,为此,我正在关注this tutorial,但在这个redirect_uri问题上遇到了麻烦。
在android的build.gradle中,我将以下内容添加到默认配置中:
applicationId = 'com.my.example_app'
manifestPlaceholders = [
'appAuthRedirectScheme': 'com.my.example_app'
]
const REDIRECT_URI = 'com.my.example_app://login-callback';
//some code in between
final AuthorizationTokenRequest req = AuthorizationTokenRequest(
CLIENT_ID,REDIRECT_URI,allowInsecureConnections: true,issuer: ISSUER,discoveryUrl: disCOVERY_URL,scopes: ScopES);
final AuthorizationTokenResponse result = await appAuth.authorizeAndExchangeCode(req);
因此,当我按login
并将其重定向到密钥斗篷页面时,我看到的只是:
有人知道这里正确的重定向uri值是什么吗?
解决方法
您的代码的问题在于您的 applicationId 和 appAuthRedirectScheme 包含对 URL 无效的“_”字符,因此我建议将应用程序包名称更改为不包含大写或除“.”以外的其他字符,并且应该工作