2026年6月25日木曜日

ソーシャルアカウント認証の実装

【メール送信】
https://mailtrap.io/signin


セキュリティとログイン ->2段階認証プロセス->   有効
検索まどから「アプリ パスワード」検索
アプリ名を入力

 54 #----------------------------------------
 55 #  GMAIL ACCOUNT    Free 500通まで     
 56 #----------------------------------------
 57 ENV_EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
 58 ENV_EMAIL_HOST='smtp.googlemail.com'
 59 ENV_EMAIL_PORT='587'
 60 ENV_EMAIL_USE_TLS='True'
 61 ENV_EMAIL_HOST_USER='xxxxxx@gmail.com'
 62 ENV_EMAIL_HOST_PASSWORD='xxxx xxxx xxxx xxxx'
 63 ENV_DEFAULT_FROM_EMAIL='XXXXXXX<noreply@secureauth.com>'
 64 ENV_DEFAULT_FROM_EMAIL='xxxxxx@gmail.com'


ソーシャルアカウント認証

【Google Cloud Console】
https://console.cloud.google.com/welcome

左上3本線から

APIサービスー>認証情報

OAuth 2.0 クライアント ID
アプリ情報

 ・プロジェクトの構成

・アプリ名
・ユーザサポートメール
対象
外部
連絡先

認証情報を作成
OAuthクライアントID
アプリケーションの種類:ウェブアプリケーション

名前:SecureAuth2026

URL1:http://localhost:3000















【GITHUB】


作成
GitHub の右上アイコン ➔ Settings ➔ 左下の Developer Settings ➔ OAuth Apps

New OAuth App

Something users will recognize and trust.

The full URL to your application homepage.

This is displayed to all users of your application.

http://localhost:3000/auth/github-callback

Your application’s callback URL. Read our OAuth documentation for more information.



【X】

































【facebook】

https://developers.facebook.com/apps/
アプリ設定ー>ベーシック-> ユースケース->  設定

https必須( httpは受けつけないもよう)






















【Django+Next.js HTTPSデバック】

■Django

pip install django-extensions Werkzeug

・settings.py
INSTALLED_APPS = [
...
"django_extensions",
]

CORS_ALLOWED_ORIGINS
CSRF_TRUSTED_ORIGINS
CORS_ALLOW_CREDENTIALS

・起動
python manage.py runserver_plus --cert-file cert.crt


sudo cp cert.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust


■next.js

npx next dev --experimental-https












0 件のコメント:

コメントを投稿

ZABBIX8.0 with postgres and nginx

■インストール前に PHP8.2以上が必要。 sudo dnf install -y epel-release sudo dnf install -y http://rpms.remirepo.net/enterprise/remi-release-9.rpm # Rocky L...