Reputation: 311
This is api doc. http://developer.dribbble.com/v1/oauth/
This is client Ids:
Client ID
3acdea730eaae4ea51dadf296be4e8edf7cd4b6ab030ce69c1de0d1a335b679d
Client Secret
4a9773911cd2304fa23047e703e35fffbd443f32a9c73207aa60b45852e17b64
Client Access Token
57fe6dc09292e4dadce94a3dc9fd895117792a48f7194bbc5b8bd229e6ef1388
Java code
String LOGIN_CALLBACK = "placeholder.com";
String LOGIN_URL = "https://dribbble.com/oauth/authorize?client_id="
+ "3acdea730eaae4ea51dadf296be4e8edf7cd4b6ab030ce69c1de0d1a335b679d"
+ "&redirect_uri=http%3A%2F%2F" + LOGIN_CALLBACK
+ "&scope=public+write+comment+upload";
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(LOGIN_URL)));
in manifest
<activity
android:name=".DribbbleLogin"
android:exported="true"
android:launchMode="singleTop">
<intent-filter>
<data
android:host="dribbble-auth-callback"
android:scheme="plain" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
what should be put in callback url and what should be passed in redirect url, so that the flow redirect to my app?
Upvotes: 0
Views: 591
Reputation: 49
Your callbackUrl should be like plain://example.com
and there is one more thing that needs to be done in the android manifest
android:host="example.com"
android:scheme="plain"
Upvotes: 2
Reputation: 311
Just put in callbackurl "plain://example.com"
in manifest
<activity
android:name=".DribbbleLogin"
android:exported="true"
android:launchMode="singleTop">
<intent-filter>
<data
android:host="example.com"
android:scheme="plain" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
In DribbbleLogin Activity
String loginCallback = "electedface.com";
String code;
Intent intent = getIntent();
if (intent != null
&& intent.getData() != null
&& !TextUtils.isEmpty(intent.getData().getAuthority())
&& loginCallback.equals(intent.getData().getAuthority())) {
code = intent.getData().getQueryParameter("code");
}
Call login url "https://dribbble.com//oauth/token" with dribbble_client_id, dribbble_client_secret and this code. you will get access_token, token_type, scope in json.
Thanks All
Upvotes: 0