We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{ "iat": "<トークン発行者>", "sub" : "<トークンの発行者>" "exp" : "<トークンの期限>" }
POST: /api/login
{ "username": "<ユーザー名>", "password": "<パスワード>" }
{ "token": "<JWTのトークン>" }
{ "error" : "failed login" }
GET: /api/public/hello
認証の必要のないアクセス
{ "message" : "hello public" }
GET: /api/private/hello
認証の必要が必要なアクセス
{ "message" : "hello private" }
{ "error" : "invalid token" }
/login
id=username
id=password
/api/auth
/public
/private
/api/private/hello
message
/api/public/private
https://github.com/healthybamboo/auth_demo
The text was updated successfully, but these errors were encountered:
Branch new/#24_create_authentication_feature_with_springboot_and_nextjs has been created.
Sorry, something went wrong.
No branches or pull requests
ポイント
やること
Design
jwt
payload
SpringBoot
POST: /api/login
送信データ
返信データ(ログイン成功時)
返信データ(ログイン失敗時)
GET: /api/public/hello
認証の必要のないアクセス
受信データ
GET: /api/private/hello
認証の必要が必要なアクセス
受信データ(認証成功時)
受信データ(認証失敗時)
Next.js
/login
初期
id=username
のテキストボックスid=password
のテキストボックスフォームの送信
/api/auth
へPOSTメソッドで送信するフォーム送信後
/public
へ遷移する/login
ページを表示し、上部にエラーメッセージを表示する/private
/public
へ遷移される/api/private/hello
へGETリクエストでmessage
を要求する/public
/api/public/private
へGETリクエストでmessage
を要求する作業場所
https://github.com/healthybamboo/auth_demo
参考文献
The text was updated successfully, but these errors were encountered: