简体   繁体   中英

OAuth 2.0 Android redirect_uri issue

I am trying to authenticate in my app using oauth 2.0 with custom redirect_uri

https://url&redirect_uri=com.ABC://redirect

It works fine on most of the Android phones. However, on few Android phones like OnePlus2, LG K8 VI am getting following exception while making HttpUrlConnection.

MalformedUrlException: Unknown Protocol: com.ABC

How should it be handled in these devices ?

The problem with the uri I can see is the custom protocol you are passing with the redirect_uri parameter.

Should be like : https://url&redirect_uri=customProtocol://redirect

Hope it helps

Without additional information it's hard to say what's wrong. However, under the assumption this is actually a URI parser bug on said devices you could try a workaround like encoding the colon character (as %3A ) like so:

https://example.com?redirect_uri=com.my.scheme%3A//redirect

That could help to avoid these parsers to misread the URI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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