I am successfully able to authenticate Facebook and Google accounts using my Oauth2 servlets. I am using state with a timer and a session cookie to try to verify that it is indeed a legitimate Oauth callback.
-
Is there any benefit if I also examine the HTTP Referer header to ensure that I was redirected from the provider’s OAuth page?
-
If no benefit, could there be a problem if I also examine the HTTP Referer field?
The answer is:
Authorization Servers are very aware of this also. And here was stated.
If you are worry about CSRF, you SHOULD NOT use the HTTP Referer as a technique to verify the origin of an authorization, that’s why the parameter state is (which sound you’re using).
If you worry about an specific security concern of the oauth2 protocol, there is a full section inside the draft.
If you worry about other Security Considerations, this is the source.
I suggest you give all your effort implementing all the validations around the param: state.
Edit: