Example #1
0
        public HttpResponseMessage GetByEmailAndOAuthId(string userEmail = null, string id_token = null, string oAuthId = null, ProviderEnum?provider = null)
        {
            bool OAuthAvailability = false;

            if (provider == ProviderEnum.Google)
            {
                OAuthAvailability = oAuthService.CheckGoogleTokenId(id_token, oAuthId);
            }
            else if (provider == ProviderEnum.Facebook)
            {
                OAuthAvailability = oAuthService.CheckFacebookTokenId(id_token, oAuthId);
            }

            if (OAuthAvailability)
            {
                bool isRegistered = userService.GetByEmailAndOAuhtId(oAuthId);

                return(Request.CreateResponse(HttpStatusCode.OK, isRegistered ? "REGISTERED" : "NOT_REGISTERED"));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "BAD_REQUEST"));
            }
        }