Sending Additional Parameters to Token in Web API with oauth2 and AngularJS

refs:

https://stackoverflow.com/questions/34517916/sending-additional-parameters-to-token-in-web-api-with-oauth2-and-angularjs


When using GrantResourceOwnerCredentials, you can retrieve the OWIN request from OAuthGrantResourceOwnerCredentialsContext and extract the custom parameter you need by calling ReadFormAsync().

public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
    var form = await context.Request.ReadFormAsync();

    if (string.Equals(form["remember"], "true", StringComparison.OrdinalIgnoreCase))
    {
        // Add custom logic to handle the "remember me" case.
    }
}

猜你喜欢

转载自blog.csdn.net/henry_wu001/article/details/80181608