Is it possible to handle the redirect URI manually with HttpUtils2 ?

fredo

Well-Known Member
Licensed User
Longtime User
I like the easy handling with HttpUtils2 but cannot figure out how to catch the data from the oauth-server reply via "redirect URI".

---------------------------------------------------------
With the old HttpUtil I got it working by sending:
B4X:
wvFbLogin.LoadUrl("https://m.facebook.com/dialog/oauth?client_id="&clientId&"&redirect_uri="&RedirectUri&"&scope=publish_stream&response_type=token")
and recieved redir data:
B4X:
Sub wvFbLogin_PageFinished (Url As String)
    If Url.StartsWith(RedirectUri&"#access_token=") Then
        AccessToken = Url.SubString((RedirectUri&"#access_token=").Length)
        AccessToken=AccessToken.SubString2(0,AccessToken.IndexOf("&"))

        Log(AccessToken) ' -----> "http://myapp.mysite.com/#access_token=AAADW......"

    End if
End Sub
---------------------------------------------------------

But if I'm trying with the new HttpUtils2:
B4X:
jobFbGetToken.poststring("https://m.facebook.com/dialog/oauth", "client_id="&clientId&"&redirect_uri="&RedirectUri&"&scope=publish_stream&response_type=token")

I receive not the expected data, but some html code without the URI information I need:
B4X:
Sub JobDone(Job As HttpJob)
    If Job.Success = True Then 
        Select Job.JobName
        Case "jobFbGetToken"

             Log(Job.GetString) ' ----> <?xml version=.....?><!DOCTYPE html PUBLIC "-/......xhtml-mobile10.dtd">

        End select
    End If
    Job.Release
End Sub
---------------------------------------------------------


Of course I could use the old Webview/LoadURL version, but while I'm changing to the new fantastic HttpUtils2 I'd like to have it coherent.


Regards,
fredo
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…