Hi. I am trying to make my twitter authentication redirect back to my app after completing authentication, but it is stuck in twitter's redirect page. what am i doing wrong? Currently trying to implement it on android.
This is what happens:
- The app loads
- I press Sign-in
- I am brought to twitter to sign in
- Twitter accepts the sign in and start redirecting me
- The app stays with the twitter redirect screen, and never leaves it.
I have added the following to my androidmanifest.xml inside after the tag
<activity android:name=".MyUriActivity">
<activity android:name="com.microsoft.windowsazure.mobileservices.authentication.RedirectUrlActivity">
<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="THENAMEOFMYAPP" android:host="easyauth.callback"/>
</intent-filter>
</activity>
</activity>
I have added this to the twitter callback URL - EDIT: Had to make the spaces to avoid getting blocked for links on the forums
https: // THENAMEOFMYAPP.azurewebsites.net / .auth / login/twitter/callback
Added this to my Constants.cs:
public static string URLScheme = "THENAMEOFMYAPP";
public static string URLIdentifier = "";
This is my OnCreate in android:
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Initialize Xamarin Forms
Forms.Init(this, bundle);
// Initialize Azure Mobile Apps
CurrentPlatform.Init();
App.Init((IAuthenticate)this);
// Load the main application
LoadApplication (new App ());
}
And this is how i call the authentication:
public async Task<bool> Authenticate()
{
var success = false;
var message = string.Empty;
try
{
user = await TodoItemManager.DefaultManager.CurrentClient.LoginAsync(
this,
MobileServiceAuthenticationProvider.Twitter,
Constants.URLScheme);
if (user != null)
{
message = string.Format("You are now signed-in as {0}.",
user.UserId);
success = true;
}
}
catch (Exception ex)
{
message = ex.Message;
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.SetMessage(message);
builder.SetTitle("Sign-in result");
builder.Create().Show();
return success;
}
What am i doing wrong, have forgotten or how do i troubleshoot this?
Thanks in advance for your time.