anchor.diff:  %% Returns:  a list with the ids of the JSON objects given
   %% @end
   -spec get_streams(JSON::string()) -> list().
  -
   get_streams(JSON) when is_tuple(JSON)->
       Result = lib_json:get_field(JSON, "hits.hits"),
       get_streams(Result);
  
positive.code: 
                  {ok, UserData} ->
                      case user_is_new(UserData) of
                          false -> replace_old_access_token(UserData, AccToken);
                          true  -> store_user(UserData, AccToken, RefToken)
                      end,
  
                      Struct = {struct, [
                          {access_token, AccToken},
                          {refresh_token, RefToken}
                      ]},
                      Res = mochijson2:encode(Struct),
                      {true, Res}
              end
      end.
  
  
  -spec replace_old_access_token(UserData::string(), AccToken::string()) -> true.
  replace_old_access_token(UserData, AccToken) ->
      true.
  
  
  -spec fetch_refresh_token(UserData::string()) -> string().
  
negative.code: analyse_token(ReqData, TokenName) ->
      case wrq:get_qs_value(TokenName, ReqData) of
          undefined  -> {error, "Not possible to perform the request. Missing " ++ TokenName};
          TokenValue -> get_user_by_token(TokenName, TokenValue)
      end.
  
  
  -spec get_user_by_token(TokenName::string(), TokenValue::string()) -> tuple().
  get_user_by_token(TokenName, TokenValue) ->
      Query = TokenName ++ ":" ++ TokenValue,
      case erlastic_search:search_limit(?INDEX, "user", Query, 500) of
          {error, Reason} -> {error, Reason};
          {ok, List} ->
              case List of
                  [] -> {error, TokenName ++ " not valid"};
                  JSON when is_tuple(JSON) ->
                      Source = lib_json:get_field(JSON, "hits.hits"),
                      Result = lib_json:get_field(Source, "_source"),
                      Tok = binary_to_list(lib_json:get_field(Result, TokenName)),
                      case TokenValue == Tok of
                          true  -> {ok, Tok};
                          false -> {error, "Not possible to perform the request. " ++ TokenName ++ " mismatches"}
                      end;
                  _ -> {error, TokenName ++ " not valid"}
              end
      end.
  
  -spec get_user_model(ReqData::tuple(), State::string()) -> {list(), tuple(), string()}.
  get_user_model(ReqData, State) ->
  