Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
- {
- //here you get the context.UserName and context.Password
- // and validates the user
- }
- $.ajax({
- type: 'POST',
- url: Helper.ApiUrl() + '/token',
- data: { grant_type: 'password', username: UserName, password: Password },
- success: function (result) {
- Helper.TokenKey(result.access_token);
- Helper.UserName(result.userName);
- },
- error: function (result) {
- Helper.HandleError(result);
- }
- });
- data: { grant_type: 'password', username: UserName, password: Password, customer: Customer }
- //here you get the context.UserName, context.Password and context.Customer
- var customer = context.Parameters.FirstOrDefault(x => x.Key == "customer").ToString()).Value;
- public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
- {
- //here you read all the params
- var data = await context.Request.ReadFormAsync();
- //here you get the param you want
- var param = data.Where(x => x.Key == "CustomParam").Select(x => x.Value).FirstOrDefault();
- string customer = "";
- if (param != null && param.Length > 0)
- {
- customer = param[0];
- }
- }
- data: { grant_type: 'password', username: user, password: pwd, CustomParam: 'MyParam' },
Add Comment
Please, Sign In to add comment