When using Owin+oauth, step-by-step testing is
Oauthoptions = new Oauthauthorizationserveroptions
{
Tokenendpointpath = new PathString ("/token"),
Provider = new Applicationoauthprovider (Publicclientid),
Authorizeendpointpath = new PathString ("/api/account/externallogin"),
Accesstokenexpiretimespan = timespan.fromdays (14)
Allowinsecurehttp = True
};
App. Useoauthbearertokens (oauthoptions); When registering middleware,
The client calls the
var logindata =
{
Grant_type: ' Password ',
Username:self.loginEmail (),
Password:self.loginPassword ()};
$.ajax ({
Type: ' POST ',
URL: '/token ',
Data:logindata}). Done (
function (data) {
Self.user (Data.username);
Cache the access token in session storage.
Sessionstorage.setitem (Tokenkey, Data.access_token);
}). Fail (showerror);
Appears 404. Not fount error, which is obviously/token endpoint does not have a start function. Found on the internet is to put allowinsecurehttp=true open, should be the default HTTPS protocol, if not open it, there is no way to call/token endpoint Service
404 Not Find When using Owin with OAuth