public class FHAuthRequest extends FHRemote
FHAuthRequest authRequest = FH.buildAuthRequest();
// This is an oAuth auth policy. Setting a presenting activity will allow the library to
automatically handle the interaction between the user and the oAuth provider.
// You also need to add the following code to your application's AndroidManifest.xml file
(inside the <application> element):
// <activity android:name="com.feedhenry.sdk.oauth.FHOAuthIntent" />;
authRequest.setPresentingActivity(this);
authRequest.setAuthPolicyId("MyGooglePolicy");
authRequest.executeAsync(new FHActCallback() {
public void success(FHResponse resp) {
Log.d("FHAuthActivity", "user sessionToken = "+ resp.getJson().getString("sessionToken"));
}
public void fail(FHResponse resp) {
Log.d("FHAuthActivity", resp.getErrorMessage());
}
});
| Modifier and Type | Field and Description |
|---|---|
protected static String |
LOG_TAG |
mCallback, mContext, PATH_PREFIX| Constructor and Description |
|---|
FHAuthRequest(android.content.Context context)
Deprecated.
please use FHActRequest(Context, FHAuthSession) instead
|
FHAuthRequest(android.content.Context context,
FHAuthSession pAuthSession) |
| Modifier and Type | Method and Description |
|---|---|
protected cz.msebera.android.httpclient.Header[] |
buildHeaders(cz.msebera.android.httpclient.Header[] pHeaders) |
void |
execute(FHActCallback pCallback)
Executes the request synchronously.
|
void |
executeAsync(FHActCallback pCallback)
Executes the request asynchronously.
|
protected String |
getPath() |
protected JSONObject |
getRequestArgs() |
void |
setAuthPolicyId(String pPolicyId)
Sets the policy ID for this auth request.
|
void |
setAuthUser(String pPolicyId,
String pUserName,
String pPassword)
Sets the user name for the auth request.
|
void |
setPresentingActivity(android.content.Context pActivity)
If the auth policy type is OAuth, user need to enter their username and password for the OAuth provider.
|
executeAsync, getApiURl, setCallbackprotected static String LOG_TAG
@Deprecated public FHAuthRequest(android.content.Context context)
context - The Android application contextpublic FHAuthRequest(android.content.Context context,
FHAuthSession pAuthSession)
context - The Android application contextpAuthSession - an FHAuthSession to store and verify tokenspublic void setAuthPolicyId(String pPolicyId)
pPolicyId - the auth policy id. It is required for all the auth requestspublic void setAuthUser(String pPolicyId, String pUserName, String pPassword)
pPolicyId - the auth policy idpUserName - the user namepPassword - the passwordprotected JSONObject getRequestArgs()
getRequestArgs in class FHRemotepublic void setPresentingActivity(android.content.Context pActivity)
pActivity - the parent Activity instance to invoke the WebViewpublic void executeAsync(FHActCallback pCallback)
FHActexecuteAsync in interface FHActexecuteAsync in class FHRemotepCallback - the callback functionpublic void execute(FHActCallback pCallback)
FHActprotected cz.msebera.android.httpclient.Header[] buildHeaders(cz.msebera.android.httpclient.Header[] pHeaders)
buildHeaders in class FHRemoteCopyright © 2016 Red Hat. All rights reserved.