provider hosted app has no access token after updated in SharePoint Store

323 Views Asked by At

I have a provider hosted SharePoint app(v1.0.0.0) and published to SharePoint Store. Now I have a new version(v1.0.0.1) (Client ID and Client Secret Key are updated) and that is also published to SharePoint store.

When the user updates the app in their site, it returns an error and I found that the app cannot get the access token with this method in TokenHelper.

public static string GetContextTokenFromRequest(HttpRequestBase request)
    {
        string[] paramNames = { "AppContext", "AppContextToken", "AccessToken", "SPAppToken" };
        foreach (string paramName in paramNames)
        {
            if (!string.IsNullOrEmpty(request.Form[paramName]))
            {
                return request.Form[paramName];
            }
            if (!string.IsNullOrEmpty(request.QueryString[paramName]))
            {
                return request.QueryString[paramName];
            }
        }
        return null;
    }

But for new user, they can install and access the app successfully.

Is there any special handling with app update?

0

There are 0 best solutions below