@strav/social 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/package.json +1 -1
- package/src/abstract_provider.ts +2 -2
- package/src/providers/discord_provider.ts +1 -1
- package/src/providers/facebook_provider.ts +1 -1
- package/src/providers/github_provider.ts +1 -1
- package/src/providers/google_provider.ts +1 -1
- package/src/providers/linkedin_provider.ts +1 -1
- package/src/schema.ts +1 -1
- package/src/social_account.ts +1 -1
- package/src/social_manager.ts +2 -2
- package/src/social_provider.ts +2 -2
- package/stubs/config/social.ts +1 -1
- package/stubs/schemas/social_account.ts +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @strav/social
|
|
2
2
|
|
|
3
|
-
OAuth social authentication for the [Strav](https://www.npmjs.com/package/@
|
|
3
|
+
OAuth social authentication for the [Strav](https://www.npmjs.com/package/@strav/core) framework. Sign in with Google, GitHub, Discord, Facebook, and LinkedIn using a fluent, driver-based API.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
bun add @
|
|
8
|
+
bun add @strav/social
|
|
9
9
|
bun strav install social
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Requires `@
|
|
12
|
+
Requires `@strav/core` as a peer dependency.
|
|
13
13
|
|
|
14
14
|
## Setup
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
|
-
import { SocialProvider } from '@
|
|
17
|
+
import { SocialProvider } from '@strav/social'
|
|
18
18
|
|
|
19
19
|
app.use(new SocialProvider())
|
|
20
20
|
```
|
|
@@ -22,7 +22,7 @@ app.use(new SocialProvider())
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
|
-
import { social } from '@
|
|
25
|
+
import { social } from '@strav/social'
|
|
26
26
|
|
|
27
27
|
// Redirect to provider
|
|
28
28
|
r.get('/auth/github', ctx => {
|
|
@@ -64,7 +64,7 @@ const user = await social.driver('google').userFromToken(accessToken)
|
|
|
64
64
|
## Custom Providers
|
|
65
65
|
|
|
66
66
|
```ts
|
|
67
|
-
import { AbstractProvider, social } from '@
|
|
67
|
+
import { AbstractProvider, social } from '@strav/social'
|
|
68
68
|
|
|
69
69
|
class SpotifyProvider extends AbstractProvider { /* ... */ }
|
|
70
70
|
social.extend('spotify', config => new SpotifyProvider(config))
|
package/package.json
CHANGED
package/src/abstract_provider.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context, Session } from '@
|
|
2
|
-
import { randomHex, ExternalServiceError } from '@
|
|
1
|
+
import type { Context, Session } from '@strav/http'
|
|
2
|
+
import { randomHex, ExternalServiceError } from '@strav/kernel'
|
|
3
3
|
import type { ProviderConfig, SocialUser, TokenResponse } from './types.ts'
|
|
4
4
|
|
|
5
5
|
const STATE_KEY = 'social_state'
|
package/src/schema.ts
CHANGED
package/src/social_account.ts
CHANGED
package/src/social_manager.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inject, Configuration, ConfigurationError } from '@
|
|
2
|
-
import { Database, toSnakeCase } from '@
|
|
1
|
+
import { inject, Configuration, ConfigurationError } from '@strav/kernel'
|
|
2
|
+
import { Database, toSnakeCase } from '@strav/database'
|
|
3
3
|
import type { AbstractProvider } from './abstract_provider.ts'
|
|
4
4
|
import type { ProviderConfig, SocialConfig } from './types.ts'
|
|
5
5
|
import { GoogleProvider } from './providers/google_provider.ts'
|
package/src/social_provider.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ServiceProvider } from '@
|
|
2
|
-
import type { Application } from '@
|
|
1
|
+
import { ServiceProvider } from '@strav/kernel'
|
|
2
|
+
import type { Application } from '@strav/kernel'
|
|
3
3
|
import SocialManager from './social_manager.ts'
|
|
4
4
|
|
|
5
5
|
export default class SocialProvider extends ServiceProvider {
|
package/stubs/config/social.ts
CHANGED