Android Question OAuth2 - Stays in Browser and does not return processing to application


Active Member
I am a beginner in B4A programming. I'm trying to do a login via OAuth2 and with that get the user's access email so that I can identify it in a database. Searching the forum I found an example. I went to the google APIs console and did all access clearance procedures. When running, it seems to work. It opens the browser and lets you choose the account, requesting permission, however, then it goes to the browser's home page and does not return to the application or display the data (which by the example should be displayed). Can someone help me please?

Sub BtnTeste_Click
    Wait For OAuth2_AccessTokenAvailable (Success As Boolean, Token As String)
    If Success = False Then
        MsgboxAsync("Erro ao Tentar Acessar","Teste")
    End If
    Dim j As HttpJob
    j.Initialize("", Me)
    'full list of features available: person.addresses,person.age_ranges,person.biographies,person.birthdays,person.bragging_rights,person.cover_photos,person.email_addresses,,person.genders,person.im_clients,person.interests,person.locales,person.memberships,person.metadata,person.names,person.nicknames,person.occupations,person.organizations,person.phone_numbers,,person.relations,person.relationship_interests,person.relationship_statuses,person.residences,person.skills,person.taglines,person.urls
    j.Download2("", _
         Array As String("access_token", Token, "requestMask.includeField", "person.email_addresses,person.birthdays,person.names"))
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        ToastMessageShow("Online data not available.", True)
    End If
End Sub

Sub ParsePersonData (data As String)
    Dim jp As JSONParser
    Dim map As Map = jp.NextObject
    Dim names As List = map.Get("names")
    If names.Size > 0 Then
        Dim name As Map = names.Get(0)
    End If
    Dim birthdays As List = map.Get("birthdays")
    If birthdays.Size > 0 Then
        Dim b As Map = birthdays.Get(0)
        b = b.Get("date")
        MsgboxAsync( $"$2{b.Get("day")}/$2{b.Get("month")}"$,"Teste")
    End If
    Dim emails As List = map.Get("emailAddresses")
    If emails.Size > 0 Then
        Dim email As Map = emails.Get(0)
        MsgboxAsync( email.Get("value"),"Teste")
    End If
End Sub