A
A
Alexander Farber2015-10-24 20:55:29
Android
Alexander Farber, 2015-10-24 20:55:29

What redirect_uri to specify for Android applications in Odnoklassniki?

Hello, I'm trying to connect Odnoklassniki to the Android application in order to get the name, gender, photo and city of the current user. Sharing is not needed, so VALUABLE_ACCESS was not requested.
Three other social networks work without problems, but I have been suffering with Odnoklassniki for the 2nd week - after the call

mOdnoklassniki = Odnoklassniki.createInstance(context, 
    "1158060544", APP_SECRET_KEY, "CBALJHAGEBABABABA");

mOdnoklassniki.setTokenRequestListener(this);
mOdnoklassniki.requestAuthorization(getContext(), this, true);

on the smartphone (although the official OK application is installed there), the browser starts and shows
https://odnoklassniki.ru/oauth/authorize?client_id=1158060544
&response_type=code
&redirect_uri=okauth%3A%2F%2Fok1158060544
&layout=m&tkn=4561&scope=null

In the application settings on Odnoklassniki, I specified its "type" as "External application, Android application" (and "External" is inserted by itself).
In the field "redirect_uri" I tried the following. values:
okauth://ok1158060544         (предложено в Android-примере на apiok.ru?)
ok1158060544://authorize     (предложено в iOS-примере на apiok.ru?)
http://slova.de                   (будущий сайт поддержки моего приложения)
http://localhost                 (от отчаяния, все равно не катит)

I checked the "Allow client OAuth authorization" checkbox.
In the AndroidManifest.xml file, I have (along with Facebook, Vkontakte and Google +) written
<activity
            android:name="ru.ok.android.sdk.OkAuthActivity"
            android:launchMode="singleTask"
            android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:scheme="okauth"
                    android:host="ok1158060544" />
            </intent-filter>
        </activity>

UPDATE:
I guess the browser launched instead of the official Odnoklassniki app, because I called
mOdnoklassniki.requestAuthorization(getContext(), this, true)

I have now changed the last parameter to false.
Also, I added the following redirect_uri in my application settings after rereading the OAuth Client Authentication document :
eb8a48475f9b4a32af17a13c5f51795f.png
But still problems - an orange window pops up and says it can't connect.
And I tried both on the emulator and on the HTC M8 and in two different German providers ...
And I tried both examples from GitHub Odnoklassniki, the old one and the new one - both write that they can’t contact api.ok.ru
Perhaps I’ll pause for a couple of weeks , I do not want to spend all my time on OK ... thanks for your attention

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aol-nnov, 2015-10-25
@afarber

Let's start with the dumb one.
<uses-permission android:name="android.permission.INTERNET"/>
is in the manifest?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question