Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamesbirtles/hapi-oauth
Allow your users to login with a number of oauth providers
https://github.com/jamesbirtles/hapi-oauth
hapi hapi-plugin hapi-v17 oauth oauth2
Last synced: 27 days ago
JSON representation
Allow your users to login with a number of oauth providers
- Host: GitHub
- URL: https://github.com/jamesbirtles/hapi-oauth
- Owner: jamesbirtles
- Created: 2017-03-11T15:29:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-24T08:00:45.000Z (over 2 years ago)
- Last Synced: 2024-10-07T13:16:37.388Z (about 1 month ago)
- Topics: hapi, hapi-plugin, hapi-v17, oauth, oauth2
- Language: TypeScript
- Homepage:
- Size: 49.8 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hapi oauth
## Usage
```ts
import * as HapiOAuth from 'hapi-oauth';// ...
class ApiOAuthHandler extends HapiOAuth.OAuthHandler {
public onLink(res: LinkSuccess, request: Request, reply: IReply): void {
// Do your stuff
}
}server.register({
register: HapiOAuth,
options: {
handler: new ApiOAuthHandler(),
baseUrl: 'http://localhost:8080',
requestConfig: {
// Change request config values here, e.g. adding optional auth (for linking existing accounts for example)
auth: { mode: 'optional', strategy: 'jwt' }
},
providers: [
new HapiOAuth.MixerProvider(
'mixerClientId',
'mixerClientSecret',
['user:details:self' /* add more scopes here */]
),
// Rinse and repeat for other providers.
]
}
});
```