2

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

https://url&redirect_uri=com.A.B.C://redirect

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

MalformedUrlException: Unknown Protocol: com.A.B.C

How should it be handled in these devices ?

MobileAppDeveloper
  • 1,048
  • 2
  • 16
  • 27

2 Answers2

1

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

Mohammed Rampurawala
  • 3,033
  • 2
  • 22
  • 32
1

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.

Marten
  • 3,802
  • 1
  • 17
  • 26