简体   繁体   English

从Chrome自定义标签中回调

[英]Callback from chrome custom tabs

I am implementing Fit-bit rest-client authorisation in my android application. 我在我的android应用程序中实现Fit-bit rest-client授权。 I use custom tabs for opening fitbit authorization URL like " https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=xxxx&scope=activity&redirect_uri=testing://callbackfitbit&prompt=login?time=time ". 我使用自定义标签来打开Fitbit授权URL,例如“ https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=xxxx&scope=activity&redirect_uri=testing://callbackfitbit&prompt=login?time=time ”。 What normally happens is I get Authorization code in my Activity class. 通常情况是,我在Activity类中获得了授权代码。 But sometimes as fitbit URL is opened in custom tabs, my application is exited. 但是有时在自定义选项卡中打开fitbit URL时,我的应用程序退出了。 I don't understand this behaviour. 我不了解这种行为。

No log is reported for this behaviour. 没有记录此行为的日志。

Any suggestion may help me understanding this behaviour. 任何建议都可以帮助我理解这种行为。

If you are integrating with an OAuth2 / OpenID Connect compliant authorization server, I would recommend AppAuth . 如果要与兼容OAuth2 / OpenID Connect的授权服务器集成,则建议使用AppAuth AppAuth provides a simpler interface for performing OAuth2 authorization and token requests, and handles all the specifics of using custom tabs and routing of responses to your app. AppAuth提供了用于执行OAuth2授权和令牌请求的更简单的界面,并处理了使用自定义标签和将响应路由到您的应用程序的所有细节。 There is also an iOS variant of the library. 该库还有一个iOS变体 Both are maintained by Google and the OpenID Foudnation. 两者均由Google和OpenID联合会维护。

Full disclosure: I'm the lead maintainer of AppAuth. 全面披露:我是AppAuth的首席维护者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM