私は Web サービスを開発しており、新しいユーザーを登録する代わりに、既知の認証プロバイダー (facebook、google など) を使用してユーザーにログインしてもらいたいと考えています。
このようなサービスの例として、スタック オーバーフローを取り上げます。
O-Authチュートリアルを読んで理解したところ、フローは次のようになります。
1. A user log in for the first time to Stack Overflow
2. User is asked to log in via Google or Facebook.
3. Stack overflow redirects the user to Google along with Stack Overflow app ID and a Redirect URL (Callback)
4. Google ask the user: "Stack overflow wants to access your account" - allow/deny.
5. Assuming the user allowed, Google will redirect the user back to Stack Overflow, and will send a Token back to stack overflow servers (the Callback URL) as well as a client ID (unique google id)
6. If this client id does not exists, Stack overflow creates a new user in its database with this client id, if it does exists, it will just return the user's data (e.g. questions asked)
7. Using the saved TOKEN, stack overflow servers can grab information from Google (if needed) without the user interaction (since the user allowed access to Google)
この流れは正しいですか?もしそうなら、ここに主な質問があります。
クライアント側
クライアントは、Stack Overflow との間で情報を送受信したいと考えています (例: 質問の投稿)。
- これが実際にユーザーであることを確認するために、クライアントはどのような情報をスタックオーバーフローサーバーに送信する必要がありますか?
サーバ側
スタック オーバーフローはどのようにこのユーザーを検証しますか? (つまり、スタック オーバーフローは、ユーザーを識別するためにユーザーにどのような情報を保存しますか? Google/Facebook ID?)
スタック オーバーフロー サーバーは、ユーザーの Google アカウント (ユーザーがこの操作を許可した) から情報を取得しようとしています。この情報を取得するために、スタック オーバー フロー サーバーが Google に送信する必要があるのはどのような種類の情報ですか。