You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are implementing OAuth2 flow on android. Our own OAuths system uses custom URL to redirect from authorising page back to the app so that the app can get the authorization_token for exchanging access_token with the OAuth server. Therefore we return our custom url in getRedirectUri() of our AuthorizationUIController.
But It now throws:
java.lang.IllegalArgumentException: java.net.MalformedURLException: Unknown protocol: {our custom scheme}
I would like to ask how thie library exchange authorization_token for access_token and if it supports custom URL redirection?
The text was updated successfully, but these errors were encountered:
I fixed this by this code, which of course is not the best practice but it did get the job done (not sure if any problems will arise because of this, but it surely will):
/**
* Sets up a url stream handler factory. This is necessary as we have a custom scheme/protocol and this in conjunction with our authentication library requires a handler to be declared, even
* though this will do nothing.
*/
private void setupURLStreamHandlerFactory() {
URLStreamHandlerFactory urlStreamHandlerFactory = new URLStreamHandlerFactory() {
@Override
public URLStreamHandler createURLStreamHandler(String protocol) {
URLStreamHandler urlStreamHandler;
if (protocol.equals(mScheme)) {
urlStreamHandler = new URLStreamHandler() {
@Override
protected URLConnection openConnection(URL u) throws IOException {
return null;
}
};
}
else {
urlStreamHandler = null;
}
return urlStreamHandler;
}
};
URL.setURLStreamHandlerFactory(urlStreamHandlerFactory);
}
We are implementing OAuth2 flow on android. Our own OAuths system uses custom URL to redirect from authorising page back to the app so that the app can get the authorization_token for exchanging access_token with the OAuth server. Therefore we return our custom url in getRedirectUri() of our AuthorizationUIController.
But It now throws:
java.lang.IllegalArgumentException: java.net.MalformedURLException: Unknown protocol: {our custom scheme}
I would like to ask how thie library exchange authorization_token for access_token and if it supports custom URL redirection?
The text was updated successfully, but these errors were encountered: