Open
Description
I've been looking for a way to authenticate a member when the access_token is supplied via query string for example.
So I have to authenticate without the use of any web api or MVC attribute.
For now I have this, but I had to copy over some internal stuff from the package, so I guess there should be a nicer way:
if (!string.IsNullOrEmpty(Request.QueryString["access_token"]))
{
const string realm = "default";
var oAuthContext = OAuth.GetContext(realm);
var principal = oAuthContext.Services.TokenService.ReadToken(Request.QueryString["access_token"]);
if (PrincipalHelper.ValidatePrincipal(principal, realm, oAuthContext.Services.UserService))
{
var name = principal.Identity.Name; // ToDo: log member in via username
}
}
Metadata
Assignees
Labels
No labels
Activity