oauth2-server
Javascript oauth2 server
Usage
const {
EggOAuth2
} = require('oauth2-server');
class OAuth2Model {
constructor(ctx) {
this.ctx = ctx;
}
getClient(id: String, secret: String): Client {}
getUser(email: String, password: String): User {}
getAuthorizationCode(code: String): AuthorizationCode {}
getAccessToken(token: String): AccessToken {}
getRefreshToken(token: String): RefreshToken {}
saveAuthorizationCode(code: AuthorizationCode, client: Client, user: User): AuthorizationCode {}
saveToken(token: Token, client: Client, user: User): Token {}
revokeAuthorizationCode(code: AuthorizationCode): Boolean {}
revokeToken(token: Token): Boolean {}
}
const oauth2 = new EggOAuth2(OAuth2Model, {
grants: [
'password',
'authorization_code'
]
});