hyperapp-is 0.1.40 → 0.1.41
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 +55 -19
- package/dist/hyperapp-is/index.d.ts +2 -2
- package/dist/hyperapp-is/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -206,8 +206,9 @@ npm で非公開の関数 (実験用)は、解説に記載します
|
|
|
206
206
|
|
|
207
207
|
**services / google**
|
|
208
208
|
- [getGoogle](#getgoogle)
|
|
209
|
-
- [
|
|
209
|
+
- [getGoogleAuthResult](#getgoogleauthresult)
|
|
210
210
|
- [getAccessToken](#getaccesstoken)
|
|
211
|
+
- [GoogleAuth](#googleauth)
|
|
211
212
|
|
|
212
213
|
## source file / ソースファイル
|
|
213
214
|
|
|
@@ -1601,29 +1602,15 @@ export const getGoogle = async (): Promise<Google>
|
|
|
1601
1602
|
|
|
1602
1603
|
---
|
|
1603
1604
|
|
|
1604
|
-
###
|
|
1605
|
-
|
|
1605
|
+
### getGoogleAuthResult
|
|
1606
|
+
ユーザートークンから、ユーザー情報を取得する
|
|
1606
1607
|
|
|
1607
1608
|
```ts
|
|
1608
|
-
export const
|
|
1609
|
-
```
|
|
1610
|
-
|
|
1611
|
-
```ts
|
|
1612
|
-
export interface GoogleAuthConfig {
|
|
1613
|
-
clientId : string
|
|
1614
|
-
autoSelect?: boolean // default: true
|
|
1615
|
-
uxMode ?: "popup" | "redirect" // default: "popup"
|
|
1616
|
-
}
|
|
1617
|
-
```
|
|
1618
|
-
|
|
1619
|
-
- clientId : アプリケーションのID (https://console.cloud.google.com で作成)
|
|
1620
|
-
- autoSelect?: ユーザーが選択されていた場合、自動でログイン
|
|
1621
|
-
- uxMode ?: ポップアップ、もしくはリダイレクトでログインします
|
|
1622
|
-
|
|
1609
|
+
export const getGoogleAuthResult = (idToken: string): GoogleAuthResult
|
|
1623
1610
|
---
|
|
1624
1611
|
|
|
1625
1612
|
### getAccessToken
|
|
1626
|
-
Googleのaccess token を取得
|
|
1613
|
+
Googleのaccess token を取得
|
|
1627
1614
|
|
|
1628
1615
|
```ts
|
|
1629
1616
|
export const getAccessToken = (config: GetAccessTokenConfig): Promise<string>
|
|
@@ -1640,3 +1627,52 @@ export interface GetAccessTokenConfig {
|
|
|
1640
1627
|
- clientId: アプリケーションのID
|
|
1641
1628
|
- scope : スコープの配列
|
|
1642
1629
|
- prompt ?: ログイン制御 `none` の場合、先にログインしていなければエラーとなります
|
|
1630
|
+
|
|
1631
|
+
---
|
|
1632
|
+
|
|
1633
|
+
### GoogleAuth
|
|
1634
|
+
Google 認証をラップしたクラス
|
|
1635
|
+
|
|
1636
|
+
```ts
|
|
1637
|
+
interface GoogleAuthConfig {
|
|
1638
|
+
clientId : string
|
|
1639
|
+
autoSelect?: boolean // default: true
|
|
1640
|
+
uxMode ?: "popup" | "redirect" // default: "popup"
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
interface GoogleButtonOptions {
|
|
1644
|
+
renderButton?: HTMLElement
|
|
1645
|
+
theme ?: "outline" | "filled_blue" | "filled_black" // default: outline
|
|
1646
|
+
size ?: "large" | "medium" | "small" // default: medium
|
|
1647
|
+
text ?: "signin_with" | "signup_with" | "continue_with" // default: signin_with
|
|
1648
|
+
shape ?: "rectangular" | "pill" | "circle" | "square" // default: rectangular
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
interface GoogleAuthResult {
|
|
1652
|
+
idToken: string
|
|
1653
|
+
user : GoogleUser
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
interface GoogleUser {
|
|
1657
|
+
name : string
|
|
1658
|
+
email : string
|
|
1659
|
+
picture: string
|
|
1660
|
+
sub : string
|
|
1661
|
+
}
|
|
1662
|
+
```
|
|
1663
|
+
|
|
1664
|
+
```ts
|
|
1665
|
+
class GoogleAuth {
|
|
1666
|
+
constructor (config: GoogleAuthConfig, option?: GoogleButtonOptions)
|
|
1667
|
+
async initialize(): Promise<GoogleAuthResult | null>
|
|
1668
|
+
logout (hit: string): void
|
|
1669
|
+
}
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
*MEMO*
|
|
1673
|
+
必ず一度だけ `initialize` を実行します
|
|
1674
|
+
プロンプトがスキップされた場合 `null` が返ります
|
|
1675
|
+
`logout` を実行したあとであれば `initialize` を再実行することが可能です
|
|
1676
|
+
`logout` 前に 2度 `initialize` を実行した場合は、エラーが発生します
|
|
1677
|
+
`logout` の `hit` は `email' か 'sub` を指定する必要があります
|
|
1678
|
+
|
|
@@ -12,5 +12,5 @@ export type { CarouselState, CarouselController } from "./animationView/carousel
|
|
|
12
12
|
export { Carousel, effect_InitCarousel } from "./animationView/carousel";
|
|
13
13
|
export type { ScrollMargin, MatrixState } from "./dom/utils";
|
|
14
14
|
export { getScrollMargin, getMatrixState } from "./dom/utils";
|
|
15
|
-
export type { GoogleAccountsId, GoogleTokenClient, GoogleAccountsOAuth2, GoogleAccounts, Google, GoogleAuthConfig, GoogleUser, GoogleAuthResult, GoogleScope, GetAccessTokenConfig
|
|
16
|
-
export { getGoogle, getGoogleAuthResult, getAccessToken } from "./services/google";
|
|
15
|
+
export type { GoogleAccountsId, GoogleTokenClient, GoogleAccountsOAuth2, GoogleAccounts, Google, GoogleAuthConfig, GoogleUser, GoogleAuthResult, GoogleScope, GetAccessTokenConfig } from "./services/google";
|
|
16
|
+
export { getGoogle, getGoogleAuthResult, getAccessToken, GoogleAuth } from "./services/google";
|
|
@@ -7,4 +7,4 @@ export { progress_easing } from "./animation/easing";
|
|
|
7
7
|
export { createUnits, createRAFProperties, effect_RAFProperties } from "./animation/properties";
|
|
8
8
|
export { Carousel, effect_InitCarousel } from "./animationView/carousel";
|
|
9
9
|
export { getScrollMargin, getMatrixState } from "./dom/utils";
|
|
10
|
-
export { getGoogle, getGoogleAuthResult, getAccessToken } from "./services/google";
|
|
10
|
+
export { getGoogle, getGoogleAuthResult, getAccessToken, GoogleAuth } from "./services/google";
|