Open
Description
Hello! I'm trying to build a Facebook login flow. Redirect url points to backend server, which exchanges code with access_token, performs registration/auth in internal systems and returns JWT (as JSON response) for making requests from app. But i can't capture this response from backend server, after auth on facebook it just redirects to redirect_url and displays JSON content to browser.
How i can properly do that i want? Should i build custom intent filter to properly handle the url? Thanks!
AndroidManifest.xml:
<activity android:name="net.openid.appauth.RedirectUriReceiverActivity"
tools:node="replace">
<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="https"
android:host="dev.example.com"
android:path="/oauth2/facebook"/>
</intent-filter>
<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="https"
android:host="dev.example.com"
android:path="/oauth2/google"/>
</intent-filter>
</activity>
This how i start auth:
private void facebookLogin() {
mAuthService = new AuthorizationService(getActivity().getApplicationContext());
AuthorizationServiceConfiguration serviceConfig =
new AuthorizationServiceConfiguration(
Uri.parse("https://www.facebook.com/dialog/oauth"), // authorization endpoint
Uri.parse("https://graph.facebook.com/v2.5/oauth/access_token")); // token endpoint
AuthorizationRequest.Builder authRequestBuilder =
new AuthorizationRequest.Builder(
serviceConfig,
FACEBOOK_APP_ID,
ResponseTypeValues.CODE,
Uri.parse("https://dev.example.com/oauth2/facebook"));
// Auth request
AuthorizationRequest authRequest = authRequestBuilder
.setScope(FACEBOOK_SCOPE)
.build();
Intent authIntent = mAuthService.getAuthorizationRequestIntent(authRequest);
startActivityForResult(authIntent, RC_AUTH);
}