What features should we add next?

Update auth providers to return token so apps can re-authenticate automatically

Right now, users have to re-log in every time they launch the client app. It would be better to provide the auth token from the provider and let the client app re-authenticate automatically.

98 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    brian dunningtonbrian dunnington shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    5 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • MichaelMichael commented  ·   ·  Flag as inappropriate

        "You can't do it with Microsoft account unless you do it with Live SDK, it's because the token passed back from Zumo Microsoft auth is signed and is not useful." - Thanks for that code snippet, but I guess it feels like I shouldn't even have to jump through those hoops (plus, I wanted to use Live). I'm sure they can figure something out to make this piece easier.

      • Xinyang QiuXinyang Qiu commented  ·   ·  Flag as inappropriate

        It's already there for facebook and google account, something like following:

        var task = App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.Facebook);
        var user = await task;
        if (!user.UserId.Equals(""))
        {
        UserAccess userAccess = new UserAccess { userId = "Facebook web login access" };
        await App.MobileService.GetTable<UserAccess>().InsertAsync(userAccess);

        App.MobileService.Logout(); // Log out the Web loging
        if (userAccess != null)
        {
        JObject jobj = new JObject();
        string token = (string) JObject.Parse(userAccess.identities).SelectToken("facebook.accessToken");
        jobj.Add("access_token", token);

        // login again with access token
        await App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.Facebook, jobj);
        await E2EZumoHelper.ZumoCRUD(4, "Token " + ZumoPermissions.Authenticated.ToString(), "Pass", "PermissionUser");

        await App.MobileService.GetTable<UserAccess>().InsertAsync(new UserAccess() { userId = "facebook token acces 1"});

        App.MobileService.Logout();
        }
        else
        {
        LogMessage("[Hint]: App unable to get User Id, Make sure add insert script in userAccess table on the portal.");
        return;
        }

        }

        For google, the parsing code is like:

        string token = (string) JObject.Parse(userAccess.identities).SelectToken("google.accessToken");
        jobj.Add("access_token", token);

        You can't do it with Microsoft account unless you do it with Live SDK, it's because the token passed back from Zumo Microsoft auth is signed and is not useful.

        You can't do it with Twitter because twitter somehow don't support token login.

      • MichaelMichael commented  ·   ·  Flag as inappropriate

        Thanks for the link to that alternative, but I hope your team makes this one a high priority. Until this is implemented, I don't think I can use the built-in login method at all, and will have to do my own authentication as Josh did. Logging into an app every time would be bad for usability, except for certain app categories like banking.

      • Nate BrossNate Bross commented  ·   ·  Flag as inappropriate

        It's hard for me to believe that this is not already a feature! Its crazy to make users login to your app every time. In same cases it might make sense, but not all, or even most I'd venture.

      Feedback and Knowledge Base