Auth0
Auto0とは
認証を担うIDaaS
フロントとバックで認証を共有する
フロント
-
UserIdTokenを取得する
-
reactなら
getAccessTokenWithPopup(local)かgetAccessTokenSilently
-
Auth0Providerにaudienceを指定するとJWTで取得できる
-
fetchのheaderに設定する
Loading...
-
loginWithRedirectで実装するとリダイレクト後のクエリストリングにcodeとstateが入ってくる
-
多分これでログインユーザーを判定して、react上のauth0と連携してると思う
-
あとからクエリを除けばOK
バック
Node.jsでユーザーの情報を取得する
-
Auth0 Management APIを使用してNode.jsでユーザーを管理してみたを参考に進める
-
Client is not authorized to access \"https://dev-jb3jt2m4.jp.auth0.com/api/v2/\". You need to create a \"client-grant\" associated to this API.....が出た
-
Auth0 Manegement API->Machine to Machine Applications
-
Client has not been granted scopes: read:usersが出た
-
Auth0 Manegement API->Machine to Machine Applications->Ahthorizedのドロップダウンを展開して、read:usersを有効にする
ログイン画面のカスタマイズ