MobileAppDeveloper
MobileAppDeveloper

Reputation: 1049

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.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 ?

Upvotes: 2

Views: 499

Answers (2)

Marten
Marten

Reputation: 3862

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.

Upvotes: 1

Mohammed Rampurawala
Mohammed Rampurawala

Reputation: 3112

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

Upvotes: 1

Related Questions