首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AppAuth RedirectUriReceiverActivity没有被抓住

AppAuth RedirectUriReceiverActivity没有被抓住
EN

Stack Overflow用户
提问于 2021-03-18 19:33:23
回答 1查看 573关注 0票数 0

我是安卓的新手,我正试图在网站上使用oauth2进行应用程序认证(在该网站中,我只能设置集成、获取ClientId和定义redirect_uri)。此网站只允许Uris作为重定向。它不允许这样的自定义方案:"br.com.myapp:/oauth2redirect“。鉴于此,我在站点上设置了"http://br.com.myapp/oauth2redirect“作为我的redirect_uri。

我正在使用AppAuth:

implementation 'net.openid:appauth:0.8.1'

在我的清单文件中,我在下面添加了意图过滤器:

代码语言:javascript
复制
<activity
    android:name="net.openid.appauth.RedirectUriReceiverActivity"
    tools:node="replace">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:scheme="http"
            android:host="br.com.myapp"
            android:pathPrefix="/oauth2redirect" />
    </intent-filter>
</activity>

在我的"build.gradle“中,我设置了:

代码语言:javascript
复制
manifestPlaceholders = [
        'appAuthRedirectScheme': 'br.com.myapp'
]

这个应用程序打开了一个CustomTabsIntent,目标oauth网站在其中被打开。我可以插入用户/通行证。然后,我被重定向到提供者站点上的另一个页面,在那里我需要接受身份验证,然后会打开一个空白页,其中包含以下消息:

代码语言:javascript
复制
This site can't be reached
br.com.myapp's server IP address could not be found
DNS_PROBE_FINISHED_NXDOMAIN

它所指向的地址是我的重定向uri:http://br.com.myapp/oauth2redirect?code=xxxx&state=xxxx

据我所知,这是正确的。问题是我的应用程序没有捕捉到这个意图。有小费吗?

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2022-03-09 15:37:18

我相信您需要将android:exported设置为"true",请参阅https://developer.android.com/guide/topics/manifest/activity-element#exported

示例:

代码语言:javascript
复制
<activity
    android:name="net.openid.appauth.RedirectUriReceiverActivity"
    tools:node="replace"
    android:exported="true">
    <intent-filter>
...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66697927

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档